gpt4 book ai didi

mysql - 无法将数据从 Cassandra 导出到 MySql

转载 作者:行者123 更新时间:2023-11-30 01:17:51 24 4
gpt4 key购买 nike

我们在将数据从 Cassandra 导出到 MySql 数据库时遇到问题。例如,
1.我创建了名为 test_ks 的 key 空间列族称为 test_cf在 cassandra 中使用 cql。

我已将一些虚拟数据插入 test_cf并在文件夹 /var/lib/cassandra/data/test_ks/test_cf 中创建相应的文件如下图所示。

[root@balnsand01 test_cf]# pwd

/var/lib/cassandra/data/test_ks/test_cf

[root@balnsand01 test_cf]# ls -lrt

total 24

-rw-r--r-- 1 root root 4340 Sep 19 03:39 test_ks-test_cf-hf-1-Statistics.db

-rw-r--r-- 1 root root 22 Sep 19 03:39 test_ks-test_cf-hf-1-Index.db

-rw-r--r-- 1 root root 16 Sep 19 03:39 test_ks-test_cf-hf-1-Filter.db

-rw-r--r-- 1 root root 89 Sep 19 03:39 test_ks-test_cf-hf-1-Data.db

-rw-r--r-- 1 root root 46 Sep 19 03:39 test_ks-test_cf-hf-1-CompressionInfo.db
  1. 当我尝试使用以下命令将此数据导出到 MySql 时,我看到数据正在以不可读的格式导出。我的意思是我无法看到我插入到 cassandra 中的数据。

./dse sqoop export --connect jdbc:mysql://127.0.0.1:3306/testdb --username testuser --password mysql123 --export-dir /var/lib/cassandra/data/test_ks/test_cf --table <table_name> --columns 'col1,col2' --input-fields-terminated-by '\t';

哪里, --export-dir /var/lib/cassandra/data/test_ks/test_cf是创建数据文件的路径。

您能否指导我到底哪里做错了。

提前致谢,桑托什

最佳答案

在 DSE 中使用 Sqoop 可以导入数据,但不能导出数据。您还可以使用Copy cmd 会将数据导出到 csv 文件中。

关于mysql - 无法将数据从 Cassandra 导出到 MySql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18876520/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com