在本章中,我们将学习如何启用/禁用身份验证,以及如何将ArangoDB绑定到公共网络接口.
# arangosh --server.endpoint tcp://127.0.0.1:8529 --server.database "_system"
它会提示您输入密码保存早期 :
Please specify a password:
使用您在配置中为root创建的密码.
您还可以使用curl检查您实际上是否正在获取需要身份验证和减号的请求的HTTP 401(未授权)服务器响应;
# curl --dump - http://127.0.0.1:8529/_api/version
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
为避免每次在学习过程中输入密码,我们将禁用身份验证.为此,打开配置文件 :
# vim /etc/arangodb3/arangod.conf
如果代码不正确,您应该更改颜色方案.
:colorscheme desert
将身份验证设置为false,如下面的屏幕截图所示.
重新启动服务 :
# service arangodb3 restart
在认证失败后,您将能够登录(使用root或创建用户,如本例中的 Harry )而无需输入任何内容中的密码请指定密码.
当验证关闭和减去时,让我们检查 api 版本;
# curl --dump - http://127.0.0.1:8529/_api/version
HTTP/1.1 200 OK X-Content-Type-Options: nosniff Server: ArangoDB Connection: Keep-Alive Content-Type: application/json; charset=utf-8 Content-Length: 60 {"server":"arango","version":"3.1.27","license":"community"}