GreatSQL社区

搜索

[已解决] MGR MEMBER_HOST字段问题

622 5 2024-1-31 16:50
本帖最后由 许怀安 于 2024-2-1 09:23 编辑

问题一:
MEMBER_HOST这个字段,MySQL官方的解释是成员的主机名,我搭建完后,显示的就是主机名,但是官网文档上却是ip?



问题二:
shell看到的成员列表,第一个是ip显示(这个是引导节点),其他的却是主机名


MGR搭建流程:
RPM安装greatsql,10.13.72.31作为引导节点,在shell中初始化完成后创建集群,其他节点用shell初始化完成后,在引导节点中使用dba.get_cluster().add_instance()函数添加成员,添加成员时,uri为 '用户@成员IP' , my.cnf配置如下:

[client]
user = root
socket = /data/greatsql/mysql.sock

[mysql]
loose-skip-binary-as-hex
prompt = '\\u@GreatSQL[\\d]> '
no-auto-rehash

[mysqld]
user = mysql
port = 3306
# 主从复制或MGR集群中,server_id记得要不同
# 另外,实例启动时会生成 auto.cnf,里面的 server_uuid 值也要不同
# server_uuid的值还可以自己手动指定,只要符合uuid的格式标准就可以
server_id = 3306
basedir = /usr/
datadir        = /data/greatsql
socket        = mysql.sock
pid-file = mysql.pid
character-set-server = UTF8MB4
skip_name_resolve = 1
# 若你的MySQL数据库主要运行在境外,请务必根据实际情况调整本参数
default_time_zone = "+8:00"

# performance setttings
lock_wait_timeout = 3600
open_files_limit    = 65535
back_log = 1024
max_connections = 512
max_connect_errors = 1000000
table_open_cache = 1024
table_definition_cache = 1024
thread_stack = 512K
sort_buffer_size = 4M
join_buffer_size = 4M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
thread_cache_size = 768
interactive_timeout = 600
wait_timeout = 600
tmp_table_size = 32M
max_heap_table_size = 32M
max_allowed_packet = 64M
net_buffer_shrink_interval = 180
# GIPK
loose-sql_generate_invisible_primary_key = ON

# log settings
log_timestamps = SYSTEM
log_error = /var/log/mysqld.log
log_error_verbosity = 3
slow_query_log = 1
log_slow_extra = 1
slow_query_log_file = slow.log
# 设置slow log文件大小1G及总文件数10
max_slowlog_size = 1073741824
max_slowlog_files = 10
long_query_time = 0.1
log_queries_not_using_indexes = 1
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 100
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_bin = binlog
binlog_format = ROW
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 2G
max_binlog_size = 1G
# 控制binlog总大小,避免磁盘空间被撑爆
binlog_space_limit = 500G
binlog_rows_query_log_events = 1
binlog_expire_logs_seconds = 604800
# MySQL 8.0.22前,想启用MGR的话,需要设置binlog_checksum=NONE才行
binlog_checksum = CRC32
gtid_mode = ON
enforce_gtid_consistency = TRUE

# myisam settings
key_buffer_size = 32M
myisam_sort_buffer_size = 128M

#replication settings
relay_log_recovery = 1
slave_parallel_type = LOGICAL_CLOCK
# 可以设置为逻辑CPU数量的2倍
slave_parallel_workers = 8
binlog_transaction_dependency_tracking = WRITESET
slave_preserve_commit_order = 1
slave_checkpoint_period = 2

# mgr settings
loose-plugin_load_add = 'mysql_clone.so'
loose-plugin_load_add = 'group_replication.so'
loose-group_replication_group_name = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1"
# MGR本地节点IPORT,请自行替换
loose-group_replication_local_address = "10.13.72.31:33061"
# MGR集群所有节点IPORT,请自行替换
loose-group_replication_group_seeds = "10.13.72.31:33061,10.13.72.33:33061,10.13.72.33:33061"
loose-group_replication_start_on_boot = ON
loose-group_replication_bootstrap_group = OFF
loose-group_replication_exit_state_action = READ_ONLY
loose-group_replication_flow_control_mode = "DISABLED"
loose-group_replication_single_primary_mode = ON
loose-group_replication_majority_after_mode = ON
loose-group_replication_communication_max_message_size = 10M
loose-group_replication_arbitrator = 0
loose-group_replication_single_primary_fast_mode = 1
loose-group_replication_request_time_threshold = 100
loose-group_replication_primary_election_mode = GTID_FIRST
loose-group_replication_unreachable_majority_timeout = 0
loose-group_replication_member_expel_timeout = 5
loose-group_replication_autorejoin_tries = 288

# innodb settings
innodb_buffer_pool_size = 2G
innodb_buffer_pool_instances = 8
innodb_data_file_path = ibdata1:12M:autoextend
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 32M
innodb_log_file_size = 2G
innodb_log_files_in_group = 3
innodb_redo_log_capacity = 6G
innodb_max_undo_log_size = 4G
# 根据服务器IOPS能力适当调整
# 一般配普通SSD盘的话,可以调整到 10000 - 20000
# 配置高端PCIe SSD卡的话,则可以调整的更高,比如 50000 - 80000
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_open_files = 65535
innodb_flush_method = O_DIRECT
innodb_lru_scan_depth = 4000
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_online_alter_log_max_size = 4G
innodb_print_ddl_logs = 0
innodb_status_file = 1
# 注意: 开启 innodb_status_output & innodb_status_output_locks 后, 可能会导致log_error文件增长较快
innodb_status_output = 0
innodb_status_output_locks = 1
innodb_sort_buffer_size = 67108864
innodb_adaptive_hash_index = 0
# 开启NUMA支持
innodb_numa_interleave = ON
innodb_print_lock_wait_timeout_info = 1
# 自动杀掉超过5分钟不活跃事务,避免行锁被长时间持有
kill_idle_transaction = 300

# innodb monitor settings
#innodb_monitor_enable = "module_innodb,module_server,module_dml,module_ddl,module_trx,module_os,module_purge,module_log,module_lock,module_buffer,module_index,module_ibuf_system,module_buffer_page,module_adaptive_hash"

# innodb parallel query
loose-force_parallel_execute = OFF
loose-parallel_default_dop = 8
loose-parallel_max_threads = 96
temptable_max_ram = 8G

# pfs settings
performance_schema = 1
# performance_schema_instrument = '%memory%=on'
performance_schema_instrument = '%lock%=on'


全部回复(5)
KAiTO 2024-1-31 16:55:57
因为你没有在my.cnf中设置report-host参数,而且你在hosts文件添加了内容所以不显示IP
yejr 2024-1-31 18:02:57
问题一中的第二个截图出处链接请提供下
许怀安 2024-1-31 18:22:26
yejr 发表于 2024-1-31 18:02
问题一中的第二个截图出处链接请提供下

https://greatsql.cn/docs/8032-25 ... status-monitor.html
yejr 2024-1-31 22:13:57
许怀安 发表于 2024-1-31 18:22
https://greatsql.cn/docs/8032-25/user-manual/8-mgr/4-mgr-status-monitor.html

问题一,在我们提供的my.cnf参考里,增加了report-host选项,因此即便设置了 /etc/hosts,则 MEMBER_HOST 这列还是显示 IP 地址,GreatSQL用户手册是没问题的。

之所以这么做,是因为在绑定动态VIP特性中需要,详见 https://greatsql.cn/docs/8032-25 ... 5-2-ha-mgr-vip.html
yejr 2024-1-31 22:16:06
问题二,Shell里看到第一个节点是IP地址,其他是主机名
这应该是因为你用shell连接第一个节点时,指定的是IP+端口方式,create_cluster() 时就识别为 IP 地址了,后面的 add_instance() 则可以显示主机名。
许怀安

3

主题

0

博客

8

贡献

新手上路

Rank: 1

积分
12

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2024-11-22 06:52 , Processed in 0.042343 second(s), 14 queries , Redis On.
快速回复 返回顶部 返回列表