连接到dockerized Rethinkdb

时间:2018-09-23 12:10:01

标签: docker rethinkdb

你好,我试图连接到RethinkDB容器无济于事。我已经下载了图像并且可以运行它,但看来我无法连接它:

我正在使用:

docker run --name rth -p 8100:8080 -d rethinkdb

我尝试连接到浏览器客户端,该客户端将端口8080暴露无济。

PS :知道rethinkdb会公开driver的端口和我也尝试过的浏览器客户端的端口:
docker run --name rth -p 27000:27015 -p 8100:8080 -d rethinkdb
。我尝试从浏览器同时连接到270008100,但都无法正常工作。我缺少什么?

PS 使用docker logs rth,我得到以下信息:

C:\Users\Adita>docker logs rth1
Recursively removing directory /data/rethinkdb_data/tmp
Initializing directory /data/rethinkdb_data
Running rethinkdb 2.3.6~0jessie (GCC 4.9.2)...
Running on Linux 4.9.93-boot2docker x86_64
Loading data from directory /data/rethinkdb_data
warn: Cache size does not leave much memory for server and query overhead (avail
able memory: 783 MB).
warn: Cache size is very low and may impact performance.
Listening for intracluster connections on port 29015
Listening for client driver connections on port 28015
Listening for administrative HTTP connections on port 8080 ////-----!!!!!!!
Listening on cluster addresses: 127.0.0.1, 172.17.0.3
Listening on driver addresses: 127.0.0.1, 172.17.0.3
Listening on http addresses: 127.0.0.1, 172.17.0.3
Server ready, "3acef1c420d2_acx" b0adc99e-19a9-4780-b336-40c2e2b38a5f

您会看到Listening for administrative HTTP connections on port 8080。为什么我不能从浏览器连接?

2 个答案:

答案 0 :(得分:1)

Rethink数据库在8080上运行28015端口和UI。

docker run -d -h `hostname` -p 8080:8080 -p 28015:28015 -p 29015:29015 -v <data-dir>:/data dockerfile/rethinkdb rethinkdb -d /data --bind all --canonical-address `curl icanhazip.com`

现在必须可以从http://loclahost:8080/的主机上访问Rethinkdb UI

答案 1 :(得分:1)

创建一个配置文件“ rethink.conf”

directory=/data/rethinkdb
log-file=/data/rethinkdb/log
bind=all
driver-port=28015
cluster-port=29015
http-port=8080

运行以下命令

docker run --name rethinkdb -d --net=host rethinkdb --config-file /path/to/rethinkdb.conf 

转到http://localhost:8080