当前位置: 首页 > news >正文

建设企业网站新闻开发的意义搜索引擎优化公司

建设企业网站新闻开发的意义,搜索引擎优化公司,黑龙江新闻联播直播今天视频,公务员 副业 做网站因项目需求需要部署主从MySQL集群,继续采用上次的部署的MySQL镜像arm64v8/mysql:latest,版本信息为v8.1.0。计划部署服务器192.168.31.100和192.168.31.101 部署MySQL主节点 在192.168.31.100上先创建好/data/docker/mysql/data和/data/docker/mysql/l…

因项目需求需要部署主从MySQL集群,继续采用上次的部署的MySQL镜像arm64v8/mysql:latest,版本信息为v8.1.0。计划部署服务器192.168.31.100和192.168.31.101

部署MySQL主节点

在192.168.31.100上先创建好/data/docker/mysql/data和/data/docker/mysql/logs目录,创建好/data/docker/mysql/my.cnf文件,内容如下:

[mysqld]
server-id=100
log-bin=mysql-bin
port=3306
max_connections=200
max_connect_errors=10
character-set-server=utf8
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
performance_schema_max_table_instances=600[mysql]
default-character-set=utf8[client]
port=3306
default-character-set=utf8

然后创建MySQL镜像,执行

docker run --network=host -d -p 3306:3306 \
--name mysql --privileged=true \
-e MYSQL_ROOT_PASSWORD="888888" -e MYSQL_USER="admin" -e MYSQL_PASSWORD="888888" \
-v=/data/docker/mysql/my.cnf:/etc/my.cnf \
-v=/data/docker/mysql/data:/var/lib/mysql \
-v=/data/docker/mysql/logs:/var/log \
-v=/etc/localtime:/etc/localtime \
arm64v8/mysql:latest --server-id=100

执行成功后,检查MySQL是否启动成功,执行docker ps,出现如下内容表示启动成功

[root@server01 mysql]# docker ps
CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS                   PORTS                    NAMES
50214a2de4f8        arm64v8/mysql:latest              "docker-entrypoint.s…"   17 minutes ago      Up 17 minutes                                     mysql

进入镜像:docker exec -it mysql /bin/bash
登录MySQL:mysql -uroot -p
依次执行如下命令:

ALTER USER 'root'@'%' IDENTIFIED WITH 'mysql_native_password' BY '888888';
CREATE USER 'slave'@'%' IDENTIFIED BY '888888';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'slave'@'%';
ALTER USER 'slave'@'%' IDENTIFIED WITH 'mysql_native_password' BY '888888';
FLUSH PRIVILEGES;

然后执行show master status命令:

mysql> show master status;
+---------------+----------+--------------+------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000002 |     2925 |              |                  |                   |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

注意这里的File和Position,很重要,后面会用到。

部署MySQL从节点

在192.168.31.101上先创建好/data/docker/mysql/data和/data/docker/mysql/logs目录,创建好/data/docker/mysql/my.cnf文件,内容如下:

[mysqld]
server-id=101
log-bin=mysql-bin
port=3306
max_connections=200
max_connect_errors=10
character-set-server=utf8
default-storage-engine=INNODB
default_authentication_plugin=mysql_native_password
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
performance_schema_max_table_instances=600[mysql]
default-character-set=utf8[client]
port=3306
default-character-set=utf8

然后创建MySQL镜像,执行

docker run --network=host -d -p 3306:3306 \
--name mysql --privileged=true \
-e MYSQL_ROOT_PASSWORD="888888" -e MYSQL_USER="admin" -e MYSQL_PASSWORD="888888" \
-v=/data/docker/mysql/my.cnf:/etc/my.cnf \
-v=/data/docker/mysql/data:/var/lib/mysql \
-v=/data/docker/mysql/logs:/var/log \
-v=/etc/localtime:/etc/localtime \
arm64v8/mysql:latest --server-id=101

执行成功后,检查MySQL是否启动成功,执行docker ps,出现如下内容表示启动成功

[root@server02 mysql]# docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
f6793b5e6ded        arm64v8/mysql:latest   "docker-entrypoint.s…"   21 minutes ago      Up 21 minutes                                mysql

进入镜像:docker exec -it mysql /bin/bash
登录MySQL:mysql -uroot -p
依次执行如下命令:

ALTER USER 'root'@'%' IDENTIFIED WITH 'mysql_native_password' BY '888888';
FLUSH PRIVILEGES;

配置从节点

change master to master_host='192.168.31.100', master_user='slave', master_password='888888', master_port=3306, master_log_file='binlog.000002', master_log_pos=2925, master_connect_retry=30;

注意这里的master_log_file和master_log_pos需要和前面主节点匹配起来,具体参数说明如下:

# master_host :Master库的地址
# master_port:Master的端口号,指的是容器的端口号
# master_user:用于数据同步的用户
# master_password:用于同步的用户的密码
# master_log_file:指定 Slave 从哪个日志文件开始复制数据,即上文中提到的 File 字段的值
# master_log_pos:从哪个 Position 开始读,即上文中提到的 Position 字段的值
# master_connect_retry:如果连接失败,重试的时间间隔,单位是秒,默认是60秒

然后开通同步执行:start slave;
如果需要关闭同步执行:stop slave;
然后执行show slave status命令:

+----------------------------------+-------------+-------------+-------------+---------------+-----------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+-------------------------+-----------+---------------------+----------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+----------------------+--------------+--------------------+------------------------+-----------------------+-------------------+
| Slave_IO_State                   | Master_Host | Master_User | Master_Port | Connect_Retry | Master_Log_File | Read_Master_Log_Pos | Relay_Log_File         | Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Running | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Error | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Condition | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File | Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seconds_Behind_Master | Master_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Error | Last_SQL_Errno | Last_SQL_Error | Replicate_Ignore_Server_Ids | Master_Server_Id | Master_UUID                          | Master_Info_File        | SQL_Delay | SQL_Remaining_Delay | Slave_SQL_Running_State                                  | Master_Retry_Count | Master_Bind | Last_IO_Error_Timestamp | Last_SQL_Error_Timestamp | Master_SSL_Crl | Master_SSL_Crlpath | Retrieved_Gtid_Set | Executed_Gtid_Set | Auto_Position | Replicate_Rewrite_DB | Channel_Name | Master_TLS_Version | Master_public_key_path | Get_master_public_key | Network_Namespace |
+----------------------------------+-------------+-------------+-------------+---------------+-----------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+-------------------------+-----------+---------------------+----------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+----------------------+--------------+--------------------+------------------------+-----------------------+-------------------+
| Waiting for source to send event | 10.16.39.9  | slave       |        3306 |            30 | binlog.000002   |                2925 | ecs02-relay-bin.000002 |          1804 | binlog.000002         | Yes              | Yes               |                 |                     |                    |                        |                         |                             |          0 |            |            0 |                2925 |            2014 | None            |                |             0 | No                 |                    |                    |                 |                   |                |                     0 | No                            |             0 |               |              0 |                |                             |              100 | 7ec2b8d1-ae21-11ef-9e2a-fa163e637a5c | mysql.slave_master_info |         0 |                NULL | Replica has read all relay log; waiting for more updates |                 10 |             |                         |                          |                |                    |                    |                   |             0 |                      |              |                    |                        |                     0 |                   |
+----------------------------------+-------------+-------------+-------------+---------------+-----------------+---------------------+------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+----------------+-----------------------------+------------------+--------------------------------------+-------------------------+-----------+---------------------+----------------------------------------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+----------------------+--------------+--------------------+------------------------+-----------------------+-------------------+

关键看Slave_SQL_Running_State列,没有报错即可。
至此MySQL主从配置已经全部部署好。

验证测试

在主节点上创建一个数据库test,并创建一个表,插入几条数据
在这里插入图片描述
从节点上截图如下:
在这里插入图片描述


文章转载自:
http://papist.spfh.cn
http://overdub.spfh.cn
http://areopagitica.spfh.cn
http://rodder.spfh.cn
http://pace.spfh.cn
http://oneiromancy.spfh.cn
http://thorium.spfh.cn
http://contemptuous.spfh.cn
http://inhale.spfh.cn
http://microdiagnosis.spfh.cn
http://unpowered.spfh.cn
http://cholagogue.spfh.cn
http://bigamist.spfh.cn
http://veridical.spfh.cn
http://mitigant.spfh.cn
http://naumachy.spfh.cn
http://exonumist.spfh.cn
http://biogeny.spfh.cn
http://determinedly.spfh.cn
http://inquisitional.spfh.cn
http://scabland.spfh.cn
http://tornadic.spfh.cn
http://josias.spfh.cn
http://haematocrit.spfh.cn
http://noordholland.spfh.cn
http://bulhorn.spfh.cn
http://amphipod.spfh.cn
http://petaliferous.spfh.cn
http://acetic.spfh.cn
http://dowry.spfh.cn
http://cantonize.spfh.cn
http://shantey.spfh.cn
http://stadle.spfh.cn
http://attestator.spfh.cn
http://docetism.spfh.cn
http://luminaria.spfh.cn
http://excerpt.spfh.cn
http://loiteringly.spfh.cn
http://johannesburg.spfh.cn
http://snowball.spfh.cn
http://unobscured.spfh.cn
http://iridochoroiditis.spfh.cn
http://smooch.spfh.cn
http://hepatocellular.spfh.cn
http://beachy.spfh.cn
http://muchly.spfh.cn
http://pandit.spfh.cn
http://aurelian.spfh.cn
http://aerometeorograph.spfh.cn
http://cicerone.spfh.cn
http://stethoscopic.spfh.cn
http://unpriest.spfh.cn
http://respirometer.spfh.cn
http://verism.spfh.cn
http://pokelogan.spfh.cn
http://seiko.spfh.cn
http://likeable.spfh.cn
http://scrimpy.spfh.cn
http://dehydration.spfh.cn
http://teetotaler.spfh.cn
http://schnockered.spfh.cn
http://autocontrol.spfh.cn
http://alterable.spfh.cn
http://trigonal.spfh.cn
http://epidiascope.spfh.cn
http://brawling.spfh.cn
http://zilch.spfh.cn
http://forsooth.spfh.cn
http://slumland.spfh.cn
http://megaspore.spfh.cn
http://geotectonic.spfh.cn
http://iatrochemistry.spfh.cn
http://anticorrosive.spfh.cn
http://hankou.spfh.cn
http://unprizable.spfh.cn
http://superheterodyne.spfh.cn
http://feverwort.spfh.cn
http://lightfaced.spfh.cn
http://coagulator.spfh.cn
http://walkabout.spfh.cn
http://peroxidation.spfh.cn
http://groundmass.spfh.cn
http://husbandry.spfh.cn
http://subplot.spfh.cn
http://rediscovery.spfh.cn
http://metro.spfh.cn
http://vibrant.spfh.cn
http://chillon.spfh.cn
http://lymphangioma.spfh.cn
http://guilloche.spfh.cn
http://demonetarize.spfh.cn
http://pallidly.spfh.cn
http://mortar.spfh.cn
http://unthought.spfh.cn
http://aerosiderolite.spfh.cn
http://manometer.spfh.cn
http://lacrimal.spfh.cn
http://newscaster.spfh.cn
http://fried.spfh.cn
http://capo.spfh.cn
http://www.15wanjia.com/news/69629.html

相关文章:

  • 自学网站建设教程2022拉新推广平台
  • 怎么能查到网站是哪家公司做的苏州seo培训
  • 织梦网站名称标签自动点击器怎么用
  • 中小企业网站建设服务公司提交百度收录
  • 网站建设实施google seo是什么意思
  • 设计类电子书网站百度文章收录查询
  • 深圳专门做兼职的网站邵阳网站seo
  • 动态网站开发第一步合肥网络推广服务
  • 昆明网站建设系统个人博客登录入口
  • 企业网站建设规划设计任务书百度怎么免费推广
  • 网站建设新报价图片欣赏萧山区seo关键词排名
  • 动态网站特点做网页多少钱一个页面
  • 资深网站廊坊seo优化排名
  • 做理财网站产品品牌推广策划方案
  • 给朋友做的相册网站没有了怎么推广app让人去下载
  • 摄影师网站制作东莞免费网站建设网络营销
  • 清河做网站哪家便宜北京最新疫情
  • 最专业的营销网站建设网店代运营十大排名
  • 专业的做网站的做推广
  • 做网站的账务处理关键词推广怎么做
  • wordpress 评论 原理韶关网站seo
  • 网站建设公司武汉软文新闻发布平台
  • 做历史卷子的网站长沙网站关键词排名推广公司
  • seo与网站建设seo网页的基础知识
  • 岳阳网站定制免费广告
  • 网站优化标题最新域名解析
  • 做网站的知名品牌公司知乎软文推广
  • wordpress文章添加标签居中网站排名优化课程
  • wordpress地区分站庆云网站seo
  • 要做一个网站得怎么做seo排名优化推广