【问题标题】:Error committing 10k records to Janus graph with cassandra使用 cassandra 向 Janus 图提交 10k 条记录时出错
【发布时间】:2019-09-27 17:40:13
【问题描述】:

我正在从 Oracle 数据库中获取大约 1000 万条记录,并尝试将这些记录保存到以 Cassandra 作为存储后端的 Janus 图中 [使用 Spark 框架]。

当我尝试循环迭代记录并尝试每 10k 提交时,我收到以下错误

 ERROR StandardJanusGraph: Could not commit transaction [1] due to storage exception in commit
    org.janusgraph.core.JanusGraphException: Could not execute operation due to backend exception

当我尝试只从 Oracle 获取第一个 1L 记录并提交每 1K 时,它工作正常。

有人可以帮我解决这个错误吗?感谢你的帮助。谢谢!!

更新:

WARN  [ReadStage-3] 2019-09-29 08:39:28,327 AbstractLocalAwareExecutorService.java:167 - Uncaught exception on thread Thread[ReadStage-3,5,main]: {}
WARN  [MemtableFlushWriter:17] 2019-09-29 09:09:40,843 NativeLibrary.java:304 - open(/var/lib/cassandra/data/circuit_equipment/system_properties-eeef4cb0e29711e9af61a34111381c19, O_RDONLY) failed, errno (2).
ERROR [MemtableFlushWriter:17] 2019-09-29 09:09:40,846 LogTransaction.java:272 - Transaction log [md_txn_flush_de900e80-e298-11e9-af61-a34111381c19.log in /var/lib/cassandra/data/circuit_equipment/system_properties-eeef4cb0e29711e9af61a34111381c19] indicates txn was not completed, trying to abort it now
ERROR [MemtableFlushWriter:17] 2019-09-29 09:09:40,847 LogTransaction.java:275 - Failed to abort transaction log [md_txn_flush_de900e80-e298-11e9-af61-a34111381c19.log in /var/lib/cassandra/data/circuit_equipment/system_properties-eeef4cb0e29711e9af61a34111381c19]
ERROR [MemtableFlushWriter:17] 2019-09-29 09:09:40,848 LogTransaction.java:222 - Unable to delete /var/lib/cassandra/data/circuit_equipment/system_properties-eeef4cb0e29711e9af61a34111381c19/md_txn_flush_de900e80-e298-11e9-af61-a34111381c19.log as it does not exist, see debug log file for stack trace
ERROR [MemtablePostFlush:9] 2019-09-29 09:09:40,849 CassandraDaemon.java:228 - Exception in thread Thread[MemtablePostFlush:9,5,main]
WARN  [StorageServiceShutdownHook] 2019-09-29 09:09:40,849 StorageService.java:4591 - Caught exception while waiting for memtable flushes during shutdown hook
ERROR [StorageServiceShutdownHook] 2019-09-29 09:09:40,931 AbstractCommitLogSegmentManager.java:308 - Failed to force-recycle all segments; at least one segment is still in use with dirty CFs.
WARN  [main] 2019-09-29 09:09:44,580 NativeLibrary.java:187 - Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out, especially with mmapped I/O enabled. Increase RLIMIT_MEMLOCK or run Cassandra as root.
WARN  [main] 2019-09-29 09:09:44,581 StartupChecks.java:169 - JMX is not enabled to receive remote connections. Please see cassandra-env.sh for more info.
WARN  [main] 2019-09-29 09:09:44,591 SigarLibrary.java:174 - Cassandra server running in degraded mode. Is swap disabled? : false,  Address space adequate? : true,  nofile limit adequate? : true, nproc limit adequate? : true
WARN  [main] 2019-09-29 09:09:44,593 StartupChecks.java:311 - Maximum number of memory map areas per process (vm.max_map_count) 65530 is too low, recommended value: 1048575, you can change it with sysctl.
WARN  [Native-Transport-Requests-1] 2019-09-29 09:12:12,841 CompressionParams.java:383 - The sstable_compression option has been deprecated. You should use class instead
WARN  [Native-Transport-Requests-1] 2019-09-29 09:12:12,842 CompressionParams.java:334 - The chunk_length_kb option has been deprecated. You should use chunk_length_in_kb instead
WARN  [main] 2019-09-29 12:59:57,584 NativeLibrary.java:187 - Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out, especially with mmapped I/O enabled. Increase RLIMIT_MEMLOCK or run Cassandra as root.
WARN  [main] 2019-09-29 12:59:57,585 StartupChecks.java:169 - JMX is not enabled to receive remote connections. Please see cassandra-env.sh for more info.
WARN  [main] 2019-09-29 12:59:57,599 SigarLibrary.java:174 - Cassandra server running in degraded mode. Is swap disabled? : false,  Address space adequate? : true,  nofile limit adequate? : true, nproc limit adequate? : true
WARN  [main] 2019-09-29 12:59:57,602 StartupChecks.java:311 - Maximum number of memory map areas per process (vm.max_map_count) 65530 is too low, recommended value: 1048575, you can change it with sysctl.
root@f451df425ca8:/var/log/cassandra#

【问题讨论】:

  • C* 或 janus 日志中是否有关于后端异常是什么的详细信息?
  • 请运行以下grep 'ERROR\|WARN' /var/log/cassandra/system.log,并将输出放入您的问题中。 system.log 位置可能会有所不同,因此请更改为适当的值。
  • @PedroGordo 在问题中附加了 cassandra ERROR/WARN 日志作为更新。你能检查一下吗!
  • @PedroGordo 感谢您的回复。在 /etc/sysctl.conf 中设置 vm.max_map_count = 1048575 是否足够,因为在以下路径中找不到 cassandra.conf 文件 - /etc/security/limits.d/cassandra.conf --禁用交换cassandra - 可以清除 /etc/fstab
  • @PedroGordo -> 更改了 /etc/security/limits.d/cassandra.conf 中的 cassandra.conf 以及 /etc/sysctl.conf 中的 vm.max_map_count = 1048575。无法重新启动服务器使用命令 sudo sysctl -p 说 -> sysctl: setting key "vm.max_map_count":Read-only file system 并且也无法运行 sudo swapoff --all (Swap disable) 说 -> swapoff : 不是超级用户。

标签: apache-spark cassandra janusgraph


【解决方案1】:

从这些消息中,您应该禁用交换(这实际上是 Cassandra 中的主要建议之一):

WARN  [main] 2019-09-29 09:09:44,580 NativeLibrary.java:187 - Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out, especially with mmapped I/O enabled. Increase RLIMIT_MEMLOCK or run Cassandra as root.
WARN  [main] 2019-09-29 09:09:44,591 SigarLibrary.java:174 - Cassandra server running in degraded mode. Is swap disabled? : false,  Address space adequate? : true,  nofile limit adequate? : true, nproc limit adequate? : true

您还应该更改max_map_count。您可以使用this guide 为生产环境设置其他值。来自此消息:

WARN  [main] 2019-09-29 12:59:57,602 StartupChecks.java:311 - Maximum number of memory map areas per process (vm.max_map_count) 65530 is too low, recommended value: 1048575, you can change it with sysctl.

【讨论】:

  • 感谢@Pedro Gordo 的回复第1 步:我们需要在/etc/sysctl.conf 中添加vm.max_map_count = 1048575。第 2 步:在以下文件夹中找不到 cassandra.conf 路径的路径。 /etc/security/limits.d/cassandra.conf。为我的问题添加step1就够了吗
  • @Sruthi 我认为/etc/security/limits.d/cassandra.conf 会根据您的操作系统稍微改变位置,但我不确定。更重要的是,不要忘记关闭交换。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-03-03
  • 1970-01-01
  • 2010-10-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多