RabbitMQ集群:无法将从节点加入主节点

时间:2020-08-06 14:05:23

标签: docker docker-compose rabbitmq debian rabbitmqctl

我有两个在不同服务器上使用docker的RabbitMQ节点:

rabbitmq-1.myhost.com(管理员) rabbitmq-2.myhost.com(从站)

我尝试加入这个奴隶,以便以此来创建一个两节点集群:

Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310}) on port 31214
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Aug 06, 2020 7:22:11 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
************************
*************************************************************
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="dateOfBirth"]/div[2]/div[2]/div/div/div[2]/div[2]/div[4]/div[1]"}
 (Session info: chrome=84.0.4147.105)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'DESKTOP-E926NDJ', ip: '192.168.178.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 84.0.4147.105, chrome: {chromedriverVersion: 84.0.4147.30 (48b3e868b4cc0..., userDataDir: C:\Users\hp\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:64230}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: dd62b7398d8b7df16f67bd9ccedc36d4
*** Element info: {Using=xpath, value=//*[@id="dateOfBirth"]/div[2]/div[2]/div/div/div[2]/div[2]/div[4]/div[1]}
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
   at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
   at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
   at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
   at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
   at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
   at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
   at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
   at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
   at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
   at newpackage.Example.main(Example.java:68)

但是我得到了

root@rabbitmq-2:/#  rabbitmqctl stop_app
Stopping rabbit application on node rabbit@rabbitmq-2 ...
root@rabbitmq-2:/# rabbitmqctl join_cluster rabbit@rabbitmq-1.myhost.com

编辑:在添加上一行之前,我先复制/ etc / hosts:

root@rabbitmq-2:/# rabbitmqctl join_cluster rabbitmq-1.myhost.com
Clustering node rabbit@rabbitmq-2 with rabbitmq-1.myhost.com
Error:
{:badarg, [{:rpc, :rpcify_exception, 2, [file: 'rpc.erl', line: 467]}, {:rpc, :call, 5, [file: 'rpc.erl', line: 410]}, {:lists, :foldl, 3, [file: 'lists.erl', line: 1263]}, {:rabbit_mnesia, :discover_cluster, 1, [file: 'src/rabbit_mnesia.erl', line: 804]}, {:rabbit_mnesia, :join_cluster, 2, [file: 'src/rabbit_mnesia.erl', line: 236]}]}

但是当我启动docker容器时我得到了这个信息:

root@rabbitmq-2:/# cat /etc/hosts

127.0.0.1localhost

::1 localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

XX.XX.XX.XX rabbitmq-1.myhost.com rabbitmq-1

YY.YY.YY.YY rabbitmq-2.myhost.com rabbitmq-2

1 个答案:

答案 0 :(得分:0)

我终于得到了将别名(rabbitmq-1和rabbitmq-2)的两个IP添加到/ etc / hosts,并在从节点(rabbitmqctl-2)中添加了以下命令:

rabbitmqctl stop_app

rabbitmqctl reset

rabbitmqctl join_cluster rabbit@rabbitmq-1

rabbitmqctl start_app

rabbitmqctl cluster_status