Cassandra management of heterogeneous recovery

This article on a convergence of backup and recovery management of Cassandra , cassandra heterogeneous describes how to recover. This heterogeneous recovery process is to copy the old library of data files to the new environment corresponding directory, then you can start the database, but before recovery also need to make some necessary changes to the new environment. The environment here is the stand-alone version, while this method is also applicable to cluster mode.

1, environmental information

Cassandra management of heterogeneous recovery

2, get tokens

If a cluster model, each node needs to obtain the IP tokens. Here is a stand-alone, acquisition method as follows:

[root@db03 ~]# nodetool ring | grep -w 192.168.120.83 | awk '{print $NF ","}' | xargs

Cassandra management of heterogeneous recovery
Note that the above command is executed out of the line, rather than multiple lines. In addition, the old and the new environment must also ensure that the value of num_tokens parameters consistent.

3, installation cassandra

The new installation cassandra on odb04, after the installation is complete, it will not start.

[root@odb04 ~]# yum -y install cassandra cassandra-tools

4, the old library synchronization profile

Since the new library is a new installation, so direct synchronization old library configuration file, make a few modifications.

[root@db04 ~]# scp 192.168.120.83:/etc/cassandra/default.conf/cassandra.yaml /etc/cassandra/default.conf/
[root@db04 ~]# scp 192.168.120.83:/etc/cassandra/default.conf/cassandra-env.sh /etc/cassandra/default.conf/
[root@db04 ~]# scp 192.168.120.83:/root/.cassandra/cqlshrc /root/.cassandra

Cassandra.yaml modify the file, following several major changes, replacing the old IP to the new IP; initial_token The second step is to get each IP tokens.

seeds: "192.168.120.84"
listen_address: 192.168.120.84
rpc_address: 192.168.120.84
initial_token: 

Cassandra management of heterogeneous recovery

5, stop the old library and synchronize data files

Stop source environment of the old library, and copy data files to the corresponding directory of the target environment:

[root@db03 ~]# systemctl stop cassandra
[root@db03 ~]# scp -r /var/lib/cassandra/data/* 192.168.120.84:/var/lib/cassandra/data/

6, start a new library and verify

[root@db04 ~]# systemctl start cassandra
[root@odb04 ~]# cqlsh 192.168.120.84

Cassandra management of heterogeneous recovery
Cassandra management of heterogeneous recovery

Guess you like

Origin blog.51cto.com/candon123/2442793