我想运行一个运行 Cassandra 4 并启用了完整查询日志 (FQL)的 Docker 容器。到目前为止,我已经尝试构建以下内容Dockerfile
:
FROM cassandra:4.0
RUN nodetool enablefullquerylog
但这失败并出现以下错误:
nodetool: Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection refused (Connection refused)'.
我还尝试取消注释full_query_logging_options
位于Docker 容器中的内容cassandra.yaml
:/etc/cassandra/cassandra.yaml
# default options for full query logging - these can be overridden from command line when executing
# nodetool enablefullquerylog
full_query_logging_options:
log_dir: /var/log/cassandra/fql.log
roll_cycle: HOURLY
block: true
max_queue_weight: 268435456 # 256 MiB
max_log_size: 17179869184 # 16 GiB
# archive command is "/path/to/script.sh %path" where %path is replaced with the file being rolled:
archive_command:
max_archive_retries: 10
理想情况下,我想在cassandra.yaml
不需要使用nodetool
命令的情况下启用 FQL,但似乎这是不可能的(只有在使用 启用它的情况下才可以配置它的选项nodetool
)?
我也不确定如何更改cassandra.yaml
以允许nodetool
连接。我注意到在cassandra
运行 Cassandra 3 的 Docker 映像中,该nodetool
命令有效;cassandra:4.0
它只是在图像中不起作用。从Cassandra 连接失败listen_address
看来,需要broadcast_address
在cassandra.yaml
. 在 Cassandra 3 Docker 容器中,我可以看到默认配置如下:
# Address or interface to bind to and tell other Cassandra nodes to connect to.
# You _must_ change this if you want multiple nodes to be able to communicate!
#
# Set listen_address OR listen_interface, not both.
#
# Leaving it blank leaves it up to InetAddress.getLocalHost(). This
# will always do the Right Thing _if_ the node is properly configured
# (hostname, name resolution, etc), and the Right Thing is to use the
# address associated with the hostname (it might not be).
#
# Setting listen_address to 0.0.0.0 is always wrong.
#
listen_address: 172.17.0.5
# Set listen_address OR listen_interface, not both. Interfaces must correspond
# to a single address, IP aliasing is not supported.
# listen_interface: eth0
# If you choose to specify the interface by name and the interface has an ipv4 and an ipv6 address
# you can specify which should be chosen using listen_interface_prefer_ipv6. If false the first ipv4
# address will be used. If true the first ipv6 address will be used. Defaults to false preferring
# ipv4. If there is only one address it will be selected regardless of ipv4/ipv6.
# listen_interface_prefer_ipv6: false
# Address to broadcast to other Cassandra nodes
# Leaving this blank will set it to the same value as listen_address
broadcast_address: 172.17.0.5
而在 Cassandra 4 容器中是
# Address or interface to bind to and tell other Cassandra nodes to connect to.
# You _must_ change this if you want multiple nodes to be able to communicate!
#
# Set listen_address OR listen_interface, not both.
#
# Leaving it blank leaves it up to InetAddress.getLocalHost(). This
# will always do the Right Thing _if_ the node is properly configured
# (hostname, name resolution, etc), and the Right Thing is to use the
# address associated with the hostname (it might not be). If unresolvable
# it will fall back to InetAddress.getLoopbackAddress(), which is wrong for production systems.
#
# Setting listen_address to 0.0.0.0 is always wrong.
#
listen_address: localhost
# Set listen_address OR listen_interface, not both. Interfaces must correspond
# to a single address, IP aliasing is not supported.
# listen_interface: eth0
# If you choose to specify the interface by name and the interface has an ipv4 and an ipv6 address
# you can specify which should be chosen using listen_interface_prefer_ipv6. If false the first ipv4
# address will be used. If true the first ipv6 address will be used. Defaults to false preferring
# ipv4. If there is only one address it will be selected regardless of ipv4/ipv6.
# listen_interface_prefer_ipv6: false
# Address to broadcast to other Cassandra nodes
# Leaving this blank will set it to the same value as listen_address
# broadcast_address: 1.2.3.4
我不太明白172.17.0.5
'来自'的地方以及为什么将其设置为该值cassandra.yaml
将允许nodetool
在容器上工作。任何想法如何nodetool
在 Cassandra 4 容器上使用来启用 FQL?