GreatSQL社区

搜索

docker-compose部署mgr集群使用my.cnf挂载报错

64 5 4 天前
ERROR 1290 (HY000) at line 143815: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143816: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143819: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143821: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143822: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143902: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143921: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143923: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 143924: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 144048: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 144052: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 144054: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 144055: The MySQL server is running with the --super-read-only option so it cannot execute this statement
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1290 (HY000) at line 2: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 3: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 4: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 5: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 6: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 7: The MySQL server is running with the --super-read-only option so it cannot execute this statement
ERROR 1290 (HY000) at line 9: The MySQL server is running with the --super-read-only option so it cannot execute this statement


docker部署的 难道不能使用my.cnf挂载么,还是说我的my.cnf配置有问题,我是先通过docker-compose部署初始化,成功部署集群

version: '3'

services:
  dcmp-greatsql-mgr1:
    image: greatsql/greatsql:8.0.32-26
    container_name: dcmp-greatsql-mgr1
    hostname: dcmp-greatsql-mgr1
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=xxxxxxx
      - MYSQL_IBP=1G
      - MYSQL_MGR_NAME=361aa3e7-5619-11ef-9988-02420a000022
      - MYSQL_MGR_LOCAL=${ip1}:33061
      - MYSQL_MGR_SEEDS=${ip1}:33061,${ip2}:33061,${ip3}:33061
      - MYSQL_INIT_MGR=1
      - MYSQL_MGR_START_AS_PRIMARY=1
      - MYSQL_MGR_ARBITRATOR=0
      - MYSQL_MGR_USER=lichen
      - MYSQL_MGR_USER_PWD="lichen@123"
    volumes:
      - ./mysql/data:/data
      - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
    network_mode: host

然后再docker cp 拿出来的3个对应的my.cnf,后续在挂载进去,就报最上面的错误
接着还有一个问题,就是docker-compose初始化这个mgr集群非常的方便,比mysql那种手动操作要方便很多,这个很值得称赞,但是他需要设定第一台服务器为主,如果主的服务器蹦了,从服务器变成了主,但是第一台重新启动之后主服务器就不会再加入集群了,我想如果能重新加入集群,是个从也好,保证mgr集群的一主两从的情况,这个有什么办法,或者手动怎么操作,我发现docker-compose初始化以后,手动加入集群都非常的困难,只能删掉从集群,删掉数据再重新加入同步才行




全部回复(5)
lce 4 天前
我的my.cnf主的配置是这样子的
root@serverdcmp:/home/appadmin/cluster/Dcmp-3.0.8-RELEASE-HOST-OFF-CLUSTER-MASTER-ubuntu20.04-x86# cat mysql/my.cnf
#
# my.cnf example for GreatSQL 8.0.32-26
#
# 下面参数选项设置仅作为参考,假定服务器配置为128C256G
#
[client]
socket    = /data/GreatSQL/mysql.sock

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

[mysqld]
user    = mysql
port    = 3306
server_id = 3306707
basedir = /usr/
datadir    = /data/GreatSQL
socket    = /data/GreatSQL/mysql.sock
pid-file = mysql.pid
character-set-server = UTF8MB4
skip_name_resolve = ON
default_time_zone = "+8:00"
bind_address = "0.0.0.0"
secure_file_priv = /data/GreatSQL
lower_case_table_names = 0

# Performance
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
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 = 28800
tmp_table_size = 32M
max_heap_table_size = 32M
max_allowed_packet = 64M
net_buffer_shrink_interval = 180
sql_generate_invisible_primary_key = ON
loose-lock_ddl_polling_mode = ON
loose-lock_ddl_polling_runtime = 200

# Logs
log_timestamps = SYSTEM
log_error = error.log
log_error_verbosity = 3
slow_query_log = ON
log_slow_extra = ON
slow_query_log_file = slow.log
long_query_time = 0.01
log_queries_not_using_indexes = ON
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 100
log_slow_admin_statements = ON
log_slow_replica_statements = ON
log_slow_verbosity = FULL
log_bin = binlog
binlog_format = ROW
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 6G
max_binlog_size = 1G
binlog_space_limit = 500G
binlog_rows_query_log_events = ON
binlog_expire_logs_seconds = 604800
binlog_checksum = CRC32
gtid_mode = ON
enforce_gtid_consistency = ON

# Replication
relay-log = relaylog
relay_log_recovery = ON
replica_parallel_type = LOGICAL_CLOCK
replica_parallel_workers = 4
binlog_transaction_dependency_tracking = WRITESET
replica_preserve_commit_order = ON
replica_checkpoint_period = 2
loose-rpl_read_binlog_speed_limit = 100

# Disalbe InnoDB PQ
loose-force_parallel_execute = OFF

# Parallel LOAD DATA
loose-gdb_parallel_load = ON
loose-innodb_optimize_no_pk_parallel_load = ON

# Rapid
loose-plugin_load_add = 'ha_rapid.so'
loose-rapid_memory_limit = 128M
loose-rapid_worker_threads = 4
loose-rapid_hash_table_memory_limit = 10
loose-secondary_engine_parallel_load_workers = 4

# Clone
loose-plugin_load_add = 'mysql_clone.so'

# MGR
loose-plugin_load_add = 'group_replication.so'
loose-group_replication_group_name = 361aa3e7-5619-11ef-9988-02420a000022
loose-group_replication_view_change_uuid = 'AUTOMATIC'
loose-group_replication_local_address = 192.168.10.186:33061
loose-group_replication_group_seeds = 192.168.10.186:33061,192.168.10.187:33061,192.168.10.188:33061
loose-group_replication_communication_stack = "XCOM"
loose-group_replication_recovery_use_ssl = OFF
loose-group_replication_ssl_mode = DISABLED
loose-group_replication_start_on_boot = ON
loose-group_replication_bootstrap_group = ON
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_enforce_update_everywhere_checks = OFF
loose-group_replication_majority_after_mode = ON
loose-group_replication_communication_max_message_size = 10M
loose-group_replication_arbitrator = OFF
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
loose-group_replication_recovery_get_public_key = ON
loose-group_replication_donor_threshold = 100

# greatdb_ha
#loose-plugin_load_add = 'greatdb_ha.so'
#loose-greatdb_ha_enable_mgr_vip = OFF
#loose-greatdb_ha_mgr_vip_nic = 'eth0'
#loose-greatdb_ha_mgr_vip_ip = '172.16.0.252'
#loose-greatdb_ha_mgr_vip_mask = '255.255.255.0'
#loose-greatdb_ha_port = 33062
#loose-greatdb_ha_mgr_read_vip_ips = "172.16.0.251,172.16.0.252"
#loose-greatdb_ha_mgr_read_vip_floating_type = "TO_ANOTHER_SECONDARY"
#loose-greatdb_ha_send_arp_packge_times = 5
#loose-greatdb_ha_mgr_exit_primary_kill_connection_mode = OFF
report_host = 192.168.10.186
report_port = 3306

# InnoDB
innodb_buffer_pool_size = 1G
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_redo_log_capacity = 128M
innodb_doublewrite_files = 2
innodb_max_undo_log_size = 4G
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_open_files = 65534
innodb_flush_method = O_DIRECT
innodb_lru_scan_depth = 4000
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = ON
innodb_print_all_deadlocks = ON
innodb_online_alter_log_max_size = 4G
innodb_print_ddl_logs = ON
innodb_status_file = ON
innodb_status_output = OFF
innodb_status_output_locks = ON
innodb_sort_buffer_size = 64M
innodb_adaptive_hash_index = OFF
innodb_numa_interleave = OFF
innodb_spin_wait_delay = 20
innodb_print_lock_wait_timeout_info = ON
kill_idle_transaction = 300
innodb_data_file_async_purge = ON

# InnoDB monitor
#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"

# PFS
#performance_schema = 1
#performance_schema_instrument = '%memory%=on'
#performance_schema_instrument = '%lock%=on'
yejr 4 天前
运行GreatSQL单节点模式(不启动MGR)的话,不要设置 MYSQL_INIT_MGR = 1,参考用下面几个参数就行


  1.       - MYSQL_ROOT_PASSWORD=xxxxxxx
  2.       - MYSQL_IBP=1G
复制代码
yejr 4 天前
yejr 发表于 2024-10-14 14:52
运行GreatSQL单节点模式(不启动MGR)的话,不要设置 MYSQL_INIT_MGR = 1,参考用下面几个参数就行

...

另外,在GreatSQL docker镜像的处理脚本 greatsql-init.sh 中,其判断逻辑是根据容器传入参数,决定是否启动 MGR,以及判定为主节点、从节点等,暂时还没办法判断主节点崩了后,从节点自动切换为主节点的行为,以后再针对这种情况做优化。

另外,可以参考k8s的工作模式,把多个容器封装在同一个pod中,一起完成整体高可用切换,用 docker-compose 方式做高可用的方案不太靠谱。
lce 4 天前
本帖最后由 lce 于 2024-10-14 17:34 编辑
yejr 发表于 2024-10-14 15:04
另外,在GreatSQL docker镜像的处理脚本 greatsql-init.sh 中,其判断逻辑是根据容器传入参数,决定是否 ...

好的,谢谢你的回答,还有个小问题,就是我容器里面的从数据库重启以后进不去集群了,有啥办法手动回去么,因为docker-compose初始化以后普通的mgr恢复命令并不能成功,就是
STOP GROUP_REPLICATION;
RESET MASTER;
START GROUP_REPLICATION USER='lichen', PASSWORD='lichen@123';

无法成功

yejr 4 天前
lce 发表于 2024-10-14 17:33
好的,谢谢你的回答,还有个小问题,就是我容器里面的从数据库重启以后进不去集群了,有啥办法手动回去么 ...

由于不知道你的具体过程,也没有具体日志,所以不好确定原因。

请先参考这个方式构建单主MGR  https://gitee.com/GreatSQL/Great ... B%E6%A8%A1%E5%BC%8F

用上述方法构建的MGR集群,(在没有发生故障主从切换前提下)从节点重启后应该是能自动加回MGR的。
lce

1

主题

0

博客

4

贡献

新手上路

Rank: 1

积分
7

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

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