我有一个场景,在同一台机器上运行两个不同版本的Cassandra,但在不同的端口。
我在端口 9161
启动了一个集群,配置如下cassandra
,
# TCP port, for commands and data
storage_port: 7000
# SSL port, for encrypted communication. Unused unless enabled in
# encryption_options
ssl_storage_port: 7004
port for the CQL native transport to listen for clients on
native_transport_port: 9043
port for Thrift to listen for clients on
rpc_port: 9161
seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "127.0.0.1"
它运行良好,
$ /usr/local/apache-cassandra-2.1.1/bin/cassandra -f
...
INFO 05:08:42 Loading settings from file:/usr/local/apache-cassandra-2.1.1/conf/cassandra.yaml
...
INFO 05:09:29 Starting listening for CQL clients on localhost/127.0.0.1:9043...
INFO 05:09:29 Binding thrift service to localhost/127.0.0.1:9161
INFO 05:09:29 Listening for thrift clients...
INFO 05:19:25 No files to compact for user defined compaction
$ jps
5866 CassandraDaemon
8848 Jps
但是,在启动另一个配置为在端口 9160
上使用 config 运行的 cassandra 集群时,
# TCP port, for commands and data
storage_port: 7000
# SSL port, for encrypted communication. Unused unless enabled in
# encryption_options
ssl_storage_port: 7004
port for the CQL native transport to listen for clients on
native_transport_port: 9042
port for Thrift to listen for clients on
rpc_port: 9160
seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "127.0.0.1"
它失败并显示消息
$ /usr/local/apache-cassandra-2.0.11/bin/cassandra -f
Unable to bind JMX, is Cassandra already running?
如何让它在同一台机器上运行两个不同版本的 cassandra?
问题是我无权停止以前的版本。我也不能使用 https://github.com/pcmanus/ccm
问题是你的新版本Cassandra也试图使用port 7199
进行JMX监控。将 JMX 端口更改为其他未使用的端口,然后它将启动。可以在名为 cassandraFolder/bin/cassandra.bat
的文件中更改 JMX 端口。会有一条线
-Dcom.sun.management.jmxremote.port=7199^
将上述端口更改为其他未使用的端口。
如果您在 Linux 环境中使用 cassandra,JMX 配置将位于名为 cassandraFolder/conf/cassandra-env.sh
的文件中。会有一条线
JMX_PORT="7199"
将其更改为其他未使用的端口。
但我不清楚你的问题。
您是否正在尝试运行新的 cassandra 以加入现有集群?
如果是,更改 JMX 端口就足够了。
您是否正在尝试以独立模式运行新的 Cassandra?
如果是,请在 yaml 文件中更改以下配置。
- 种子:"127.0.0.2"
- listen_address:127.0.0.2
- rpc_address:127.0.0.2
添加以下条目,
127.0.0.1 127.0.0.2
在/etc/hosts
文件中,如果您正在运行 Linux。如果您在 Windows 中运行,请在C:WindowsSystem32driversetchosts
文件中添加上述条目。如果您的意图是在独立模式下运行,那么在配置中要小心。如果你做错了什么,那么你的新 cassandra 将加入到现有的集群中。
此链接可帮助您在单个窗口计算机中运行Cassandra集群
我通过更改更多配置来修复它,这些配置在conf/cassandra.yaml
中storage_port
/ssl_storage_port
,在conf/cassandra-env.sh
中JMX_PORT
,
conf/cassandra.yaml
# TCP port, for commands and data
storage_port: 7004
# SSL port, for encrypted communication. Unused unless enabled in
# encryption_options
ssl_storage_port: 7005
port for the CQL native transport to listen for clients on
native_transport_port: 9043
port for Thrift to listen for clients on
rpc_port: 9161
seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "127.0.0.1"
康夫/卡桑德拉-env.sh
# Specifies the default port over which Cassandra will be available for
# JMX connections.
JMX_PORT="7200"