Cassandra 无效的 Yaml 尽管有有效值
Cassandra Invalid Yaml despite valid values
我正在 Windows 中编写一个 python 脚本,它接收一个 cassandra.yaml 文件,写入一个具有不同值的新文件,然后将该文件复制到 linux 服务器。但是,我在启动 cassandra 时从 linux 服务器收到此错误:
ERROR 00:53:03 Exception encountered during startup
org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml. Please remove properties [credentials_validity_in_ms, prepared_statements_cache_size_mb, transparent_data_encryption_options, thrift_prepared_statements_cache_size_mb, column_index_cache_size_in_kb] from your cassandra.yaml
at org.apache.cassandra.config.YamlConfigurationLoader$MissingPropertiesChecker.check(YamlConfigurationLoader.java:188) ~[apache-cassandra-3.0.7.jar:3.0.7]
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:119) ~[apache-cassandra-3.0.7.jar:3.0.7]
我查看了复制到 linux 服务器的文件,下面是在 vi 中查看的一部分。该错误是否与错误消息所说的无效属性有关,或者是否与回车 returns 而不是换行符有关?或者完全是其他东西(如果需要,可以 post 完整的 yaml 文件)?
# Validity period for credentials cache. This cache is tightly coupled to^M
# the provided PasswordAuthenticator implementation of IAuthenticator. If^M
# another IAuthenticator implementation is configured, this cache will not^M
# be automatically used and so the following settings will have no effect.^M
# Please note, credentials are cached in their encrypted form, so while^M
# activating this cache may reduce the number of queries made to the^M
# underlying table, it may not bring a significant reduction in the^M
# latency of individual authentication attempts.^M
# Defaults to 2000, set to 0 to disable credentials caching.^M
credentials_validity_in_ms: 2000^M
^M
# Refresh interval for credentials cache (if enabled).^M
Does the error have to do with invalid properties like the error
message says?
是的。我认为这与您使用 python 脚本添加的属性有关。我也尝试添加了一些附加属性(不属于原来的cassandra.yaml),但是cassandra启动失败。我认为在 cassandra.yaml
中是不允许的
does it have to do with the carriage returns instead of line feed
characters?
我不这么认为。至于这个错误,它明确指出你不能在cassandra.yaml.
中使用任何附加属性
DOS/Windows 使用 CR-LF 字符作为行分隔符,但基于 Linux 的系统仅使用 LF。这就是 ^M 字符出现在 vi 编辑器中的原因。您可以使用 dos2unix
实用程序从任何文件中删除 CR 字符。
顺便说一句,为什么要在 cassandra.yaml 文件中添加这些属性?您可以创建自己的 属性 文件并从那里读取可配置值
我正在 Windows 中编写一个 python 脚本,它接收一个 cassandra.yaml 文件,写入一个具有不同值的新文件,然后将该文件复制到 linux 服务器。但是,我在启动 cassandra 时从 linux 服务器收到此错误:
ERROR 00:53:03 Exception encountered during startup
org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml. Please remove properties [credentials_validity_in_ms, prepared_statements_cache_size_mb, transparent_data_encryption_options, thrift_prepared_statements_cache_size_mb, column_index_cache_size_in_kb] from your cassandra.yaml
at org.apache.cassandra.config.YamlConfigurationLoader$MissingPropertiesChecker.check(YamlConfigurationLoader.java:188) ~[apache-cassandra-3.0.7.jar:3.0.7]
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:119) ~[apache-cassandra-3.0.7.jar:3.0.7]
我查看了复制到 linux 服务器的文件,下面是在 vi 中查看的一部分。该错误是否与错误消息所说的无效属性有关,或者是否与回车 returns 而不是换行符有关?或者完全是其他东西(如果需要,可以 post 完整的 yaml 文件)?
# Validity period for credentials cache. This cache is tightly coupled to^M
# the provided PasswordAuthenticator implementation of IAuthenticator. If^M
# another IAuthenticator implementation is configured, this cache will not^M
# be automatically used and so the following settings will have no effect.^M
# Please note, credentials are cached in their encrypted form, so while^M
# activating this cache may reduce the number of queries made to the^M
# underlying table, it may not bring a significant reduction in the^M
# latency of individual authentication attempts.^M
# Defaults to 2000, set to 0 to disable credentials caching.^M
credentials_validity_in_ms: 2000^M
^M
# Refresh interval for credentials cache (if enabled).^M
Does the error have to do with invalid properties like the error message says?
是的。我认为这与您使用 python 脚本添加的属性有关。我也尝试添加了一些附加属性(不属于原来的cassandra.yaml),但是cassandra启动失败。我认为在 cassandra.yaml
中是不允许的does it have to do with the carriage returns instead of line feed characters?
我不这么认为。至于这个错误,它明确指出你不能在cassandra.yaml.
中使用任何附加属性DOS/Windows 使用 CR-LF 字符作为行分隔符,但基于 Linux 的系统仅使用 LF。这就是 ^M 字符出现在 vi 编辑器中的原因。您可以使用 dos2unix
实用程序从任何文件中删除 CR 字符。
顺便说一句,为什么要在 cassandra.yaml 文件中添加这些属性?您可以创建自己的 属性 文件并从那里读取可配置值