Cassandra Migrating table Data

Source: Internet
Author: User
Tags cassandra

There are 2 ways to migrate table data in Cassandra, with Keyspace named user mydb,table as an example:

Method one: Copy command.

This approach is suitable for situations where the amount of data is small.
1. Enter Cqlsh, input command: COPY mydb.user to '/USR/USR.SCV ';

  


2. Locate the USR.SCV file that you just generated and copy it to the server that you want to migrate

  


3. In the Migrated data table user (the table structure is the same), and then enter the COPY mydb.user from '/USR/USER.SCV '; Note: Here the key space can be different
  

By the end of the first approach, this approach is suitable for situations where data volumes are small.

Method Two: Sstableloader
  
Sstableloader provides a solution for migrating data across a cluster, reference http://docs.datastax.com/en/cassandra/3.0/cassandra/tools/toolsBulkloader.html.
In this way, you need to build the same key space and table structure in the migrated database .
Using the command:./sstableloader-d 192.168.3.90-u CASSANDRA-PW cassandra-t 100/var/lib/cassandra/data/mydb/ user-77470310dc9111e6b83b3767ed5523d2/
  
  
  
-D: Migrated server ip;-u: The user name of the migrated cluster,-PW: User password for migrating the cluster,-T: Limit traffic, and finally the directory (/.../keyspace_name/table_name) in which the cluster is being migrated to store data.
Note:
1. If the cluster has multiple nodes, each node needs to execute the above command
2. Sometimes a table will have multiple catalogs
    

In this case, the final path is to select the path to the directory that contains the. db file (the latest table)
    

When all nodes of the cluster are executed, the migration of the table data is completed.

    

  

Cassandra Migrating table Data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.