我怎么能让MariaDB 10.1只听IPv4?奇怪但是真的是我第一次安装MariaDB并启动它时,我看到它正在正确地监听IPv4,如下面的示例图片所示
但奇怪的是,由于某些原因重新安装MariaDB并重新启动我的Centos 7安装后,它似乎已经开始只听IPv6了,因此我无法让Galera集群工作(当它正在侦听IPv4时工作正常) . 那么我如何让这个MariaDB只听IPv4 . 以下是我机器的截图
[root@dataqry-0001 ~]# netstat -ntpl | grep sql
tcp6 0 0 :::3306 :::* LISTEN 14323/mysqld
/etc/my.cnf.d/server.cnf的内容(请注意我也尝试取消注释绑定地址,它仍然是奇怪的)
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]
我应该补充一点,我对遍布各地的MariaDB / MySQL设置感到困惑 . 上面的绑定地址是Galera我想的 . 这是我第一次在Centos 7上使用MariaDB,所以道歉 - 我甚至尝试过早地禁用IPv6,但没有显示它在IPv4上收听
谢谢M.M.
1 回答
虽然官方MariaDB错误跟踪器中的信息似乎表明这是不可能的,除非使用
mysql
软件;我可以确认在例如中设置以下配置选项/etc/my.cnf
,至少在使用版本10.1.21-MariaDB
时, does 按预期工作,如@Hackerman的评论中所述 .我误解的误解/误导/不相关的官方错误跟踪器:
MDEV-6536(开放)
MDEV-4379(已结束)
但是,要回答与特定情况相关的问题,您应该注意设置该设置的“部分”;也就是说,你把它写在
[galera]
部分,而不是服务器范围的[mysqld]
部分 .