我的設定
我在同一個節點上啟動了兩個 SiriDB 服務器,但使用不同的埠:
第一臺服務器:
- server_name: %HOSTNAME:9010
- 監聽客戶端埠:9000
- http_api_port: 9020
第二臺服務器:
- server_name: %HOSTNAME:9011
- 監聽客戶端埠:9001
- http_api_port: 9021
情況
我使用以下 curl 命令創建了一個新副本:
curl --location --request POST 'http://localhost:9021/new-replica' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic c2E6c2lyaQ==' \
--header 'Content-Type: text/plain' \
--data-raw '{
"dbname": "dbtest",
"username": "iris",
"password": "siri",
"host": "localhost",
"port": 9000,
"pool": 0
}'
上面命令的回應是OK。
但在服務器日志記錄中,我看到以下錯誤訊息:
Connecting to back-end server 'my-hostname-xxx:9010' failed (error: connection refused)
執行list servers查詢時,服務器似乎無法找到彼此:
curl --location --request POST 'http://localhost:9021/query/dbtest' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic aXJpczpzaXJp' \
--header 'Content-Type: text/plain' \
--data-raw '{"q": "list servers"}'
這是回應:
{"columns":["status"],"servers":[["offline"],["running | synchronizing"]]}
我找不到問題所在,因為服務器在同一主機上運行。所以,他們應該能找到對方吧?
uj5u.com熱心網友回復:
很可能您的系結不正確。你能檢查一下是否是這種情況嗎?
默認情況下,127.0.0.1出于安全原因,SiriDB 僅系結到 (localhost)。
既然%HOSTNAME使用了,可能是 SiriDB 正在監聽另一個介面。
如果您使用的是組態檔,您可能需要同時將bind_server_address和更改bind_client_address為::(any)。
注意:同樣的設定可以使用環境變數SIRIDB_BIND_SERVER_ADDRESS和SIRIDB_BIND_CLIENT_ADDRESS.
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/441423.html
