[英]Docker tcp can only use "localhost" but not "127.0.0.1" or ip to connect
[英]Arangodb Docker Container: Could not connect to endpoint 'tcp://127.0.0.1:8529', database: '_system', username: 'root' docker
我已经通过ArangoDb
在 Ubuntu 20.04 中安装了docker
,并启动了一个实例:
raphy@pc:~$ sudo docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 -d --name arangodb-instance arangodb/arangodb
ca6c80f7895c1e6b379937c8b2e71a3d0134ab0d39b09b87ecd2a0feb55b53e4
raphy@pc:~$ sudo docker run -e ARANGO_RANDOM_ROOT_PASSWORD=1 --name playground --link arangodb-instance:db-link arangodb/arangodb
===========================================
GENERATED ROOT PASSWORD: Uyi2Su3XNQggybWR
===========================================
Initializing root user...Hang on...
2022-07-04T16:34:01Z [9] INFO [f6e0e] {aql} memory limit per AQL query automatically set to 20163799449 bytes. to modify this value, please adjust the startup option `--query.memory-limit`
2022-07-04T16:34:01Z [9] INFO [a1c60] {syscall} file-descriptors (nofiles) hard limit is 1048576, soft limit is 1048576
2022-07-04T16:34:02Z [9] INFO [c1b63] {arangosearch} ArangoSearch maintenance: [1..1] commit thread(s), [1..1] consolidation thread(s)
2022-07-04T16:34:02Z [9] INFO [7da27] {startup} server will now shut down due to upgrade, database initialization or admin restoration.
Initializing database...Hang on...
Database initialized...Starting System...
2022-07-04T16:34:06Z [1] INFO [e52b0] {general} ArangoDB 3.9.2 [linux] 64bit, using jemalloc, build tags/v3.9.2-0-g8bf70c5f5b6, VPack 0.1.35, RocksDB 6.27.0, ICU 64.2, V8 7.9.317, OpenSSL 1.1.1o 3 May 2022
2022-07-04T16:34:06Z [1] INFO [75ddc] {general} detected operating system: Linux version 5.13.0-52-generic (buildd@lcy02-amd64-067) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #59~20.04.1-Ubuntu SMP Thu Jun 16 21:21:28 UTC 2022
2022-07-04T16:34:06Z [1] INFO [25362] {memory} Available physical memory: 33606332416 bytes, available cores: 8
2022-07-04T16:34:06Z [1] INFO [3bb7d] {cluster} Starting up with role SINGLE
2022-07-04T16:34:06Z [1] INFO [f6e0e] {aql} memory limit per AQL query automatically set to 20163799449 bytes. to modify this value, please adjust the startup option `--query.memory-limit`
2022-07-04T16:34:06Z [1] INFO [a1c60] {syscall} file-descriptors (nofiles) hard limit is 1048576, soft limit is 1048576
2022-07-04T16:34:06Z [1] INFO [fe333] {engines} RocksDB recovery starting, scanning WAL starting from sequence number 94, latest sequence number: 205
2022-07-04T16:34:06Z [1] INFO [a4ec8] {engines} RocksDB recovery finished, WAL entries scanned: 115, recovery start sequence number: 94, latest WAL sequence number: 205, max tick value found in WAL: 116, last HLC value found in WAL: 1737440567212638208
2022-07-04T16:34:06Z [1] INFO [c1b63] {arangosearch} ArangoSearch maintenance: [1..1] commit thread(s), [1..1] consolidation thread(s)
2022-07-04T16:34:06Z [1] INFO [6ea38] {general} using endpoint 'http+tcp://0.0.0.0:8529' for non-encrypted requests
2022-07-04T16:34:07Z [1] INFO [cf3f4] {general} ArangoDB (version 3.9.2 [linux]) is ready for business. Have fun!
现在,我想使用ArangoShell
:
我打开了另一个控制台
raphy@pc:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
608013c29220 arangodb/arangodb "/entrypoint.sh aran…" 33 minutes ago Up 33 minutes 8529/tcp playground
ca6c80f7895c arangodb/arangodb "/entrypoint.sh aran…" 34 minutes ago Up 34 minutes 8529/tcp arangodb-instance
但是,尝试遵循这些指示: https ://hub.docker.com/r/arangodb/arangodb/
我收到此错误:
Could not connect to endpoint 'tcp://127.0.0.1:8529', database: '_system', username: 'root'
raphy@pc:~$ sudo docker exec playground arangosh
_
__ _ _ __ __ _ _ __ __ _ ___ ___| |__
/ _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \
| (_| | | | (_| | | | | (_| | (_) \__ \ | | |
\__,_|_| \__,_|_| |_|\__, |\___/|___/_| |_|
|___/
arangosh (ArangoDB 3.9.2 [linux] 64bit, using jemalloc, build tags/v3.9.2-0-g8bf70c5f5b6, VPack 0.1.35, RocksDB 6.27.0, ICU 64.2, V8 7.9.317, OpenSSL 1.1.1o 3 May 2022)
Copyright (c) ArangoDB GmbH
Command-line history will be persisted when the shell is exited. You can use `--console.history false` to turn this off
Could not connect to endpoint 'tcp://127.0.0.1:8529', database: '_system', username: 'root'
Error message: 'not authorized to execute this request'
Uf wiederluege! 再见! Na shledanou! Auf Wiedersehen! Bye Bye! Adiau! ¡Hasta luego! Εις το επανιδείν! ءاقللا ىلإ
להתראות! Arrivederci! Tot ziens! Adjö! Au revoir! さようなら До свидания! Até Breve! خداحافظ! Uz redzēšanos! შეხვედრამდე 안녕히 가세요! Sampai jumpa!
raphy@pc:~$
如何将 arangosh 连接到arangosh
arangodb container
的实例?
通过这种方式,它似乎工作正常:
raphy@pc:~$ sudo docker run -e ARANGO_ROOT_PASSWORD=mypwd -p 8529:8529 -d --name arangodb-instance arangodb/arangodb
10fea7fd22ff14e6e2c773adaedb79df4698d25e2b57fb35ae896988d495f298
raphy@pc:~$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
10fea7fd22ff arangodb/arangodb "/entrypoint.sh aran…" 2 minutes ago Up 2 minutes 0.0.0.0:8529->8529/tcp, :::8529->8529/tcp arangodb-instance
raphy@pc:~$ sudo docker exec -it arangodb-instance arangosh
Please specify a password:
_
__ _ _ __ __ _ _ __ __ _ ___ ___| |__
/ _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \
| (_| | | | (_| | | | | (_| | (_) \__ \ | | |
\__,_|_| \__,_|_| |_|\__, |\___/|___/_| |_|
|___/
arangosh (ArangoDB 3.9.2 [linux] 64bit, using jemalloc, build tags/v3.9.2-0-g8bf70c5f5b6, VPack 0.1.35, RocksDB 6.27.0, ICU 64.2, V8 7.9.317, OpenSSL 1.1.1o 3 May 2022)
Copyright (c) ArangoDB GmbH
Command-line history will be persisted when the shell is exited. You can use `--console.history false` to turn this off
Connected to ArangoDB 'http+tcp://127.0.0.1:8529, version: 3.9.2 [SINGLE, server], database: '_system', username: 'root'
Type 'tutorial' for a tutorial or 'help' to see common examples
127.0.0.1:8529@_system>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.