【问题标题】:Changing commitlog directory in cassandra在 cassandra 中更改 commitlog 目录
【发布时间】:2018-04-10 05:38:18
【问题描述】:

当前 commitlog 目录指向 Directory1。我想将它更改为不同的目录 D2。迁移应该如何?

【问题讨论】:

    标签: cassandra cassandra-2.1


    【解决方案1】:

    我们就是这样做的。我们有一个与 Cassandra 1.1.2 对话的负载平衡客户端,每个客户端都存在于每个 Cassandra 节点上。

    1. 耗尽您的服务。
      • 等待负载平衡器移除节点。
    2. 停止本地节点上的服务以停止直接 Client-Cassandra 写入:systemctl stop <your service name>
    3. 此时应该没有更多的写入并且磁盘活动大大减少:
      • iostat 2 - 磁盘活动应该接近于零
      • nodetool gossipinfo
    4. 禁用 Cassandra gossip 协议以标记节点死亡并停止 Cassandra-Cassandra 写入:nodetool disablegossip
    5. 将提交日志的所有内容刷新到 SSTables 中:nodetool flush
    6. 清空节点——这个命令比 nodetool flush 更重要,(并且可能包括 nodetool flush 的所有行为):nodetool drain
    7. 停止 cassandra 进程:systemctl stop cassandra
    8. 修改 Cassandra 配置文件,例如vi /etc/cassandra/default.conf/cassandra.yaml
    9. 启动 Cassandra:systemctl start cassandra
    10. 等待 10-20 分钟。尾 Cassandra 日志跟随,例如tail -F /var/log/cassandra/system.log
    11. 在移动到下一个节点之前确认环是健康的:nodetool ring
    12. 重新启动客户端服务:systemctl start <your service here>

    请注意,我们不需要自己手动复制提交日志文件。冲洗和排水处理了这一点。然后文件慢慢地重新出现在新的commitlog_dir 位置。

    【讨论】:

      【解决方案2】:

      您可以更改 cassandra.yaml 中的提交日志目录(键:“commitlog_directory”)并将所有日志复制到新目标。

      https://docs.datastax.com/en/cassandra/2.1/cassandra/configuration/configCassandra_yaml_r.html#reference_ds_qfg_n1r_1k__commitlog_directory

      commitlog_directory

      存储提交日志的目录。默认位置: 软件包安装:/var/lib/cassandra/commitlog Tarball 安装: install_location/data/commitlog 以获得最佳写入 性能,将提交日志放在单独的磁盘分区上,或者 (理想情况下)与数据文件目录分开的物理设备。 因为提交日志只是追加的,所以一个 HDD 是可以接受的 这个目的。

      【讨论】:

      • 让我试试这个..问题是我在同一个磁盘上同时拥有提交日志和数据目录..现在我想把它分开。谢谢 itstata
      猜你喜欢
      • 2020-01-21
      • 2014-05-29
      • 1970-01-01
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 1970-01-01
      • 2014-08-09
      • 2016-03-30
      相关资源
      最近更新 更多