Advertisement
Guest User

Untitled

a guest
Feb 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. version: '2'
  2.  
  3. volumes:
  4. dbdata:
  5. external: false
  6.  
  7. services:
  8.  
  9. # the MariaDB database MASTER container
  10. #
  11. database:
  12. image: mariadb:10.3.4
  13. env_file:
  14. - ./env/.env.database
  15. volumes:
  16. - dbdata:/data/db
  17. - /etc/localtime:/etc/localtime:ro
  18. # mount the configuration files in the approriate place
  19. #
  20. - ./database/master/etc/mysql/conf.d:/etc/mysql/conf.d:ro
  21. # mount the SQL files for initialization in a place where the
  22. # database container will look for it on initialization; see
  23. # "Initializing a fresh instance" at
  24. # https://hub.docker.com/_/mariadb/ for details
  25. #
  26. - ./database/master/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro
  27. ports:
  28. - "3306:3306"
  29.  
  30. # the MariaDB database SLAVE container
  31. #
  32. slave:
  33. image: mariadb:10.3.4
  34. # env_file:
  35. # - ./env/.env.database
  36. environment:
  37. - MYSQL_ALLOW_EMPTY_PASSWORD=yes
  38. volumes:
  39. - /etc/localtime:/etc/localtime:ro
  40. # mount the configuration files in the approriate place
  41. #
  42. - ./database/slave/etc/mysql/conf.d:/etc/mysql/conf.d:ro
  43. # mount the SQL files for initialization in a place where the
  44. # database container will look for it on initialization; see
  45. # "Initializing a fresh instance" at
  46. # https://hub.docker.com/_/mariadb/ for details
  47. #
  48. - ./database/slave/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:ro
  49. depends_on:
  50. - database
  51.  
  52. # the root user password
  53. #
  54. MYSQL_ROOT_PASSWORD=password
  55.  
  56. # the database to use
  57. #
  58. MYSQL_DATABASE=mydatabase
  59.  
  60. GRANT REPLICATION SLAVE ON *.* TO 'replicant'@'%' IDENTIFIED BY 'password';
  61.  
  62. [mariadb]
  63. log-bin
  64. server_id=1
  65. log-basename=master1
  66.  
  67. # force binlog format to ROW to avoid issues with
  68. # replicate_do_db
  69. binlog_format=ROW
  70.  
  71. -- configure the connection to the master
  72. --
  73. CHANGE MASTER TO
  74. MASTER_HOST='database',
  75. MASTER_USER='replicant',
  76. MASTER_PASSWORD='password',
  77. MASTER_PORT=3306,
  78. MASTER_USE_GTID=slave_pos,
  79. MASTER_CONNECT_RETRY=10;
  80.  
  81. -- start the slave
  82. --
  83. START SLAVE;
  84.  
  85. [mariadb]
  86. server_id=1000
  87. relay-log = /var/log/mysql/mysql-relay-bin.log
  88. log_bin = /var/log/mysql/mysql-bin.log
  89.  
  90. Could not execute Write_rows_v1 event on table mysql.user; Duplicate entry 'localhost-root' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement