In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how compose files create clusters in swarm". The explanation in this article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to create clusters in compose files in swarm".
Brief introduction
First, inconsistent with the above environment: 1. The cluster address of etcd cluster is: 10.0.102.214virtual 2379Magi 10.0.102.175purl 2379recover10.0.102.191REX 2379 2. Solve the network communication problem: let the docker stack share the same network: because the network is created with the stack name when stack is deployed, keep the same stack name on the same network. As follows: docker stack deploy-c compose_swarm_1.yaml stack name docker stack deploy-c compose_swarm_2.yaml stack name docker stack deploy-c compose_swarm_3.yamlstack name
Prepare each node to create directories to be mounted and files to be mounted (such as Mariadb configuration file with binlog enabled) # mkdir / data1/#mkdir / etc/my.cnf.d create mariadb configuration file with binlog enabled on k8s-node-3 node # vim / etc/my.cnf.d/bin-log.cnf [mysqld] log-bin= mysql-binlog_slave_updates = 1expire_logs_days = 20server-id = 211master node deployment operation [ Root@node-1 ~] # docker stack deploy-c compose_swarm_1.yaml swarm_mariadb [see figure 1] [root@node-1 ~] # docker stack deploy-c compose_swarm_2.yaml swarm_mariadb [see figure 2] [root@node-1 ~] # docker stack deploy-c compose_swarm_3.yaml swarm_mariadb [see figure 3] check [root@node-1 ~] # docker service ls [see figure 4] [root@node-1] # docker stack ps swarm _ mariadb [see figure 5] [root@node-1 ~] # docker exec-it a40e41c2219a / bin/bash [root@a40e41c2219a /] # mysql-uroot-pmypasswordMariaDB [(none)] > show status like 'wsrep%' [see figure 6] or [root@node-1 ~] # mysql-uroot-pmypassword-h node-1-P 3311-e "show status like 'wsrep%';"
Yaml file compose_swarm_1.yamlversion: '3'services: mariadb_galera_swarm0: # service name The three files are different deploy: replicas: 1 # there is only one container under each service: restart_policy: condition: on-failure delay: 10s max_attempts: 10 window: 100s placement: constraints: [node.hostname==node-1] # run the container on the fixed node update_config: parallelism: 1 delay: 3m # higher Than SST duration image: severalnines/mariadb:10.1 ports:-"3310CLUSTER_NAME 3306" # the exposed port three nodes cannot be the same environment: # to create a cluster-related environment must be consistent CLUSTER_NAME: "mariadb_cluster_swarm" DISCOVERY_SERVICE: "10.0.102.218VR 2379Magne 10.0.102.151RU 2379Magi 10.0.102.162VOR 2379" MYSQL_ROOT_PASSWORD: " Mypassword "XTRABACKUP_PASSWORD:" mypassword "command:-innodb_buffer_pool_size=256M-max_connections=81 volumes: # Mount on demand-/ etc/my.cnf.d:/etc/my.cnf.d-/ data2:/var/lib/mysql-/ etc/localtime:/etc/localtime healthcheck: interval: 5s timeout: 3s Retries: 200 # interval * retries > SST duration networks:-galera_swarm # Network networks: galera_swarm: driver: overlaycompose_swarm_2.yamlversion: '3'services: mariadb_galera_swarm1: deploy: replicas: 1 restart_policy: condition: on-failure delay: 10s max_attempts: 10 window: 100s placement: constraints: [node.hostname==node-2] Update_config: parallelism: 1 delay: 3m # higher than SST duration image: severalnines/mariadb:10.1 ports:-"3312 higher than SST duration image 3306" network_mode: host environment: CLUSTER_NAME: "mariadb_cluster_swarm" DISCOVERY_SERVICE: "10.0.102.218 delay 2379" MYSQL_ROOT_PASSWORD: "mypassword" XTRABACKUP_PASSWORD: "mypassword" command:-innodb_buffer_pool_size=256M-max_connections=81 volumes:-/ etc/my.cnf.d:/etc/my.cnf.d-/ data2:/var/lib/mysql-/ etc/localtime:/etc/localtime healthcheck: interval: 5s timeout: 3s retries: 200 # interval * retries > SST duration networks :-galera_swarmnetworks: galera_swarm: driver: overlaycompose_swarm_3.yamlversion: '3'services: mariadb_galera_swarm2: deploy: replicas: 1 restart_policy: condition: on-failure delay: 10s max_attempts: 10 window: 100s placement: constraints: [node.hostname==node-3] update_config: parallelism: 1 delay : 3m # higher than SST duration image: severalnines/mariadb:10.1 ports:-"3313network_mode 3306" network_mode: host environment: CLUSTER_NAME: "mariadb_cluster_swarm" DISCOVERY_SERVICE: "10.0.102.218purl 2379Magi 10.0.102.151Rich 2379Magi 10.0.102.162 2379" MYSQL_ROOT_PASSWORD: "mypassword" XTRABACKUP_PASSWORD: "mypassword" command: -innodb_buffer_pool_size=256M-max_connections=81 volumes:-/ etc/my.cnf.d:/etc/my.cnf.d-/ data2:/var/lib/mysql-/ etc/localtime:/etc/localtime healthcheck: interval: 5s timeout: 3s retries: 200 # interval * retries > SST duration networks:-galera_swarmnetworks: galera_swarm: driver: overla Thank you for reading The above is the content of "how compose files create clusters in swarm". After the study of this article, I believe you have a deeper understanding of how compose files create clusters in swarm, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.