在同一台机器上运行两个cassandra版本

时间:2015-01-11 05:37:58

标签: cassandra jmx

我有一个场景可以在同一台机器上运行两个不同版本的cassandra,但是在不同的端口。

我在端口cassandra启动了一个群集,其中9161配置如下,

# 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

然而,启动另一个cassandra集群配置为使用config,

在端口9160上运行
# 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

2 个答案:

答案 0 :(得分:2)

问题是你的新版本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文件中更改以下配置。

  • 种子:&#34; 127.0.0.2&#34;
  • listen_address:127.0.0.2
  • rpc_address:127.0.0.2

添加以下条目

127.0.0.1       127.0.0.2
如果您在linux中运行,请在/etc/hosts文件中

。如果您在Windows中运行,请在C:\Windows\System32\drivers\etc\hosts文件中添加以上条目。如果您的意图是在独立模式下运行,那么请注意您的配置。如果你做错了,那么你的新cassandra将加入到现有的集群中。

这个link可以帮助您在单个Windows机器中运行cassandra集群

答案 1 :(得分:0)

我修改了它,修改了storage_portssl_storage_port / conf/cassandra.yamlJMX_PORTconf/cassandra-env.sh的更多配置,

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"

CONF / cassandra-env.sh

# Specifies the default port over which Cassandra will be available for                             
# JMX connections.                                                                                                                                    
JMX_PORT="7200"