Arangodb 简明教程
ArangoDB - Web Interface
在本章中,我们将学习如何启用/禁用身份验证,以及如何将 ArangoDB 绑定到公用网络接口。
In this chapter, we will learn how to enable/disable the Authentication, and how to bind the ArangoDB to the Public Network Interface.
# arangosh --server.endpoint tcp://127.0.0.1:8529 --server.database "_system"
它会提示你输入之前保存的密码 −
It will prompt you for the password saved earlier −
Please specify a password:
使用你在配置中为 root 创建的密码。
Use the password you created for root, at the configuration.
你还可以使用 curl 来检查你实际上是否收到对要求身份验证的请求的 HTTP 401(未授权)服务器响应 −
You can also use curl to check that you are actually getting HTTP 401 (Unauthorized) server responses for requests that require authentication −
# curl --dump - http://127.0.0.1:8529/_api/version
Output
HTTP/1.1 401 Unauthorized
X-Content-Type-Options: nosniff
Www-Authenticate: Bearer token_type = "JWT", realm = "ArangoDB"
Server: ArangoDB
Connection: Keep-Alive
Content-Type: text/plain; charset = utf-8
Content-Length: 0
为了避免在我们的学习过程中每次输入密码,我们将禁用身份验证。为此,打开配置文件 −
To avoid entering the password each time during our learning process, we will disable the authentication. For that, open the configuration file −
# vim /etc/arangodb3/arangod.conf
如果代码不可见,你应该更改颜色方案。
You should change the color scheme if the code is not properly visible.
:colorscheme desert
如下面的屏幕截图所示,将身份验证设置为 false。
Set authentication to false as shown in the screenshot below.
重启服务 −
Restart the service −
# service arangodb3 restart
将身份验证设为 false 后,你将能够登录(在本例中,可以使用 root 或像 Harry 这样的已创建用户),而无需在 please specify a password 中输入任何密码。
On making the authentication false, you will be able to login (either with root or created user like Harry in this case) without entering any password in please specify a password.
让我们在关闭身份验证时检查 api 版本 −
Let us check the api version when the authentication is switched off −
# curl --dump - http://127.0.0.1:8529/_api/version