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

PHP做网站的核心是什么2022今天出京入京最新通知

PHP做网站的核心是什么,2022今天出京入京最新通知,淘宝网站建设那么便宜,北京市公司网站制作总结:整理不易,如果对你有帮助,可否点赞关注一下? 更多详细内容请参考:《Linux运维篇:Linux系统运维指南》 一、部署背景 由于业务系统的特殊性,我们需要面向不通的客户安装我们的业务系统&…

总结:整理不易,如果对你有帮助,可否点赞关注一下?

更多详细内容请参考:《Linux运维篇:Linux系统运维指南》


一、部署背景

由于业务系统的特殊性,我们需要面向不通的客户安装我们的业务系统,而作为基础组件中的mongodb针对不同的客户环境需要多次部署集群,作为一个运维工程师,提升工作效率也是工作中的重要一环。所以我觉得有必要针对 X86_64 + ARM64 CPU架构mongodb 7.0.14容器版 分片集群编写自动化部署工具。

CPU架构 docker版本 docker-compose版本
X86_64 26.1.3 v2.29.0
ARM64 26.1.3 v2.29.0

二、工具介绍

一键部署工具实现功能如下:

1、支持ARM64、X86_64架构CPU
2、支持单实例部署
3、支持单机伪分片集群部署(1个config副本集+2个分片副本集+3路由节点)
4、支持多机分布式分片集群部署(1个config副本集+2个分片副本集+3路由节点)
5、支持数据目录、日志目录、端口、账号、密码、副本集合名称、最大并发连接数等灵活配置
6、支持数据文件、日志文件、配置文件持久化
7、支持创建、启动、停止、卸载等操作
8、支持一键连接、一键备份、一键还原等操作

如下图所示:
在这里插入图片描述
在这里插入图片描述

说明:工具使用非常简单,只需要修改变量文件,就可以快速帮你快速部署mongodb 7.0.14分片集群。


三、工具下载

基于X86_64+ARM64架构CPU使用docker-compose一键离线部署mongodb 7.0.14容器版分片集群工具


四、部署步骤

说明:单机伪集群是指在单主机部署mongodb分片集群,分布式集群是指在多个不同主机上部署mongodb分片集群,这里部署的是多机分布式分片集群。


1、查看帮助命令
在这里插入图片描述


2、部署规划

说明:这里由于资源限制,使用4台服务器部署分片集群。如果你的资源充足,建议每个实例使用单独1台服务器部署。

宿主机IP 操作系统 内核版本 节点说明
192.168.1.111 操作系统 5.15.0-113-generic 配置服务副本集(1primary+2secondary,共3个实例)
192.168.1.112 操作系统 5.15.0-113-generic 分片1副本集(1primary+1secondary+1arbiter,共3个实例)
192.168.1.113 操作系统 5.15.0-113-generic 分片2副本集(1primary+1secondary+1arbiter,共3个实例)
192.168.1.114 操作系统 5.15.0-113-generic 路由节点(3个mongos实例)

3、准备一键部署工具包

说明:将一键部署工具包分别上传到mongodb分片集群所有节点上。


4、编辑变量文件

说明:以下操作分别在mongodb分片集群节点的部署工具包中修改cluster.conf文件, 三个节点上cluster.conf文件内容一致

root@localhost:/opt/mongodb-shard-cluster# cp cluster.conf.tpl cluster.conf
root@localhost:/opt/mongodb-shard-cluster# vim cluster.conf
# 部署顺序: 
#   1、配置节点 > 分片节点1 > 分片节点2 > 路由节点
#   2、配置节点顺序为secondary2>secondary1>primary,分片节点顺序为arbiter>secondary>primary,路由节点顺序为route1>route2>route3
# 建议填写为当前磁盘最大存储空间目录,如果系统盘空间最大,建议填写为/data,如果挂在盘空间最大,建议填写为挂载目录
export BASE_DIR="/data"# cpu架构,可选值为<x86_64和aarch64>,根据实际情况修改
export CPU_PLATFROM="x86_64"# mongodb版本,默认不修改
export MONGODB_VERSION="7.0.14"# Mongodb数据存放根目录,默认即可,建议不要修改
export MONGODB_DATA_DIR="${BASE_DIR}/basic-data/mongodb-shard-cluster"
##################################################################################################################
# 注意:容器网络模式为<host主机网络模式>,监听地址填写为宿主机内网地址,<主机名为容器的主机名,非宿主机主机名>
# mongodb<配置服务>副本集信息
export MONGODB_CONFIG_PRIMARY_HOST_IP="192.168.1.111"                     # primary实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_CONFIG_PRIMARY_HOST_NAME="config-primary.mongo.com"        # primary实例主机名,可根据实际情况修改
export MONGODB_CONFIG_PRIMARY_HOST_PORT="17101"                           # primary实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGODB_CONFIG_SECONDARY1_HOST_IP="192.168.1.111"                  # secondary1实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_CONFIG_SECONDARY1_HOST_NAME="config-secondary1.mongo.com"  # secondary1实例主机名,可根据实际情况修改
export MONGODB_CONFIG_SECONDARY1_HOST_PORT="17102"                        # secondary1实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGODB_CONFIG_SECONDARY2_HOST_IP="192.168.1.111"                  # secondary2实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_CONFIG_SECONDARY2_HOST_NAME="config-secondary2.mongo.com"  # secondary2实例主机名,可根据实际情况修改
export MONGODB_CONFIG_SECONDARY2_HOST_PORT="17103"                        # secondary2实例映射宿主机端口,端口不冲突情况下,建议不修改
export MONGODB_CONFIG_REPLICASET_NAME="config-rs"                         # config服务副本集合名称,默认即可,建议不修改# mongodb<分片1>副本集信息
export MONGODB_SHARD1_PRIMARY_HOST_IP="192.168.1.112"                     # primary实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_SHARD1_PRIMARY_HOST_NAME="shard1-primary.mongo.com"        # primary实例主机名,可根据实际情况修改
export MONGODB_SHARD1_PRIMARY_HOST_PORT="17201"                           # primary实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGODB_SHARD1_SECONDARY_HOST_IP="192.168.1.112"                   # secondary实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_SHARD1_SECONDARY_HOST_NAME="shard1-secondary.mongo.com"    # secondary实例主机名,可根据实际情况修改
export MONGODB_SHARD1_SECONDARY_HOST_PORT="17202"                         # secondary实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGODB_SHARD1_ARBITER_HOST_IP="192.168.1.112"                     # arbiter实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_SHARD1_ARBITER_HOST_NAME="shard1-arbiter.mongo.com"        # arbiter实例主机名,可根据实际情况修改
export MONGODB_SHARD1_ARBITER_HOST_PORT="17203"                           # arbiter实例映射宿主机端口,端口不冲突情况下,建议不修改
export MONGODB_SHARD1_REPLICASET_NAME="shard1-rs"                         # 分片1副本集合名称,默认即可,建议不修改# mongodb<分片2>副本集信息
export MONGODB_SHARD2_PRIMARY_HOST_IP="192.168.1.113"                     # primary实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_SHARD2_PRIMARY_HOST_NAME="shard2-primary.mongo.com"        # primary实例主机名,可根据实际情况修改
export MONGODB_SHARD2_PRIMARY_HOST_PORT="17301"                           # primary实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGODB_SHARD2_SECONDARY_HOST_IP="192.168.1.113"                   # secondary实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_SHARD2_SECONDARY_HOST_NAME="shard2-secondary.mongo.com"    # secondary实例主机名,可根据实际情况修改
export MONGODB_SHARD2_SECONDARY_HOST_PORT="17302"                         # secondary实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGODB_SHARD2_ARBITER_HOST_IP="192.168.1.113"                     # arbiter实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGODB_SHARD2_ARBITER_HOST_NAME="shard2-arbiter.mongo.com"        # arbiter实例主机名,可根据实际情况修改
export MONGODB_SHARD2_ARBITER_HOST_PORT="17303"                           # arbiter实例映射宿主机端口,端口不冲突情况下,建议不修改
export MONGODB_SHARD2_REPLICASET_NAME="shard2-rs"                         # 分片2副本集合名称,默认即可,建议不修改# mongods<路由实例>信息
export MONGOS_ROUTE1_HOST_IP="192.168.1.114"                              # mongos1实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGOS_ROUTE1_HOST_NAME="route1.mongo.com"                         # mongos1实例主机名,可根据实际情况修改
export MONGOS_ROUTE1_HOST_PORT="17401"                                    # mongos1实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGOS_ROUTE2_HOST_IP="192.168.1.114"                              # mongos2实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGOS_ROUTE2_HOST_NAME="route2.mongo.com"                         # mongos2实例主机名,可根据实际情况修改
export MONGOS_ROUTE2_HOST_PORT="17402"                                    # mongos2实例映射宿主机端口,端口不冲突情况下,建议不修改export MONGOS_ROUTE3_HOST_IP="192.168.1.114"                              # mongos3实例监听地址,建议填写<宿主机内网地址>,根据实际情况填写
export MONGOS_ROUTE3_HOST_NAME="route3.mongo.com"                         # mongos3实例主机名,可根据实际情况修改
export MONGOS_ROUTE3_HOST_PORT="17403"                                    # mongos3实例映射宿主机端口,端口不冲突情况下,建议不修改# mongos或mongod接受的最大并行连接数,如果该设置高于操作系统配置<文件描述符,ulimit -n>的最大连接跟踪阈值,则该设置无效 
export MONGODB_MAX_CONNECTIONS="10000"# Mongodb分片集群<admin库+管理账号+密码>,密码要求大小写和数字,且8位以上,根据实际情况填写
# 注意:<分片集群用户admin库管理账号密码>与<本地分片admin库用户管理账号和密码>相同,均使用MONGODB_ADMIN_USER和MONGODB_ADMIN_PASSWORD变量
export MONGODB_ADMIN_USER="admin"          
export MONGODB_ADMIN_PASSWORD="Kzyh9nwyDWuL"# Mongodb分片集群<读写库+用户账号+密码>,密码要求大小写和数字,且8位以上,根据实际情况填写
# 注意:<分片集群读写库用户管理账号密码>与<本地分片读写库用户管理账号和密码>相同,均使用MONGODB_ADMIN_USER和MONGODB_ADMIN_PASSWORD变量
export MONGODB_READWRITE_DATABASE="lolaage"
export MONGODB_READWRITE_USER="lolaage"
export MONGODB_READWRITE_PASSWORD="Kzyh9nwyDWuL"
##################################################################################################################

5、执行部署

说明:部署顺序必须为
1、配置节点 > 分片节点1 > 分片节点2 > 路由节点
2、配置节点顺序为secondary2>secondary1>primary,分片节点顺序为arbiter>secondary>primary,路由节点顺序为route1>route2>route3


a、配置服务副本集部署(192.168.1.111)

root@localhost:/opt/mongodb-shard-cluster# ./op.sh build config-secondary2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build config-secondary1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build config-primary

如下图所示:
在这里插入图片描述


b、分片1副本集部署(192.168.1.112)

root@localhost:/opt/mongodb-shard-cluster# ./op.sh build shard1-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build shard1-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build shard1-primary

如下图所示:
在这里插入图片描述


c、分片2副本集部署(192.168.1.113)

root@localhost:/opt/mongodb-shard-cluster# ./op.sh build shard2-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build shard2-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build shard2-primary

如下图所示:
在这里插入图片描述


d、路由节点部署(192.168.1.114)

root@localhost:/opt/mongodb-shard-cluster# ./op.sh build route1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build route2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh build route3

如下图所示:
在这里插入图片描述


6、检查集群状态

root@localhost:/opt/mongodb-shard-cluster# ./op.sh check route3

如下图所示:
在这里插入图片描述


五、其它操作

5.1、启动

说明:分别在对应主机节点上执行。

root@localhost:/opt/mongodb-shard-cluster# ./op.sh start config-secondary2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start config-secondary1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start config-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh start shard1-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start shard1-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start shard1-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh start shard2-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start shard2-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start shard2-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh start route1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start route2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh start route3

5.2、停止

说明:分别在对应主机节点上执行。

root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop config-secondary2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop config-secondary1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop config-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh stop shard1-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop shard1-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop shard1-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh stop shard2-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop shard2-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop shard2-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh stop route1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop route2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh stop route3

5.3、检查

说明:分别在对应主机节点上执行。

root@localhost:/opt/mongodb-shard-cluster# ./op.sh check config-secondary2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check config-secondary1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check config-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh check shard1-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check shard1-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check shard1-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh check shard2-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check shard2-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check shard2-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh check route1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check route2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh check route3

5.4、卸载

说明:分别在对应主机节点上执行。

root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear config-secondary2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear config-secondary1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear config-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh clear shard1-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear shard1-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear shard1-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh clear shard2-arbiter
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear shard2-secondary
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear shard2-primaryroot@localhost:/opt/mongodb-shard-cluster# ./op.sh clear route1
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear route2
root@localhost:/opt/mongodb-shard-cluster# ./op.sh clear route3

5.5、连接

说明:分别在对应主机节点上执行。

root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect config-secondary2
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect config-secondary1
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect config-primaryroot@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect shard1-arbiter
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect shard1-secondary
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect shard1-primaryroot@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect shard2-arbiter
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect shard2-secondary
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect shard2-primaryroot@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect route1
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect route2
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_connect.sh connect route3

5.6、备份(支持单机和分片集群模式)

说明:在route3节点上执行。

root@localhost:/opt/mongodb-shard-cluster# cd tools
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_backup.sh backup route3

注意:如果你想手动备份还原,建议参考《Linux运维总结:使用 MongoDB工具备份和恢复mongodb 7.0.14分片集群(方案一)》。


5.7、还原(仅支持单机模式)

root@localhost:/opt/mongodb-shard-cluster# cd tools
root@localhost:/opt/mongodb-shard-cluster/tools# ./auto_backup.sh backup single

注意:由于分片集群还原操作,比较复杂,建议参考《Linux运维总结:使用 MongoDB工具备份和恢复mongodb 7.0.14分片集群(方案一)》。


总结:整理不易,如果对你有帮助,可否点赞关注一下?

更多详细内容请参考:《Linux运维篇:Linux系统运维指南》

http://www.yayakq.cn/news/527989/

相关文章:

  • 做精美得ppt网站知乎wordpress 网络图片不显示
  • 无锡城乡建设局网站中山顺的网站建设
  • 百度对新网站排名问题做网站收入
  • 大连服务公司 网站wordpress 栏目模板
  • 放射科网站建设织梦 别人 网站 模板
  • 建筑类企业网站模板下载有域名怎么建立网站
  • seo优化网站教程百度百度推广一年要多少钱
  • 兰州工业发展建设有限公司网站网络营销案例2020
  • 门户网站建设中存在的问题k网站建设
  • 电子商务网站的主要评价指标有教你做网站和学习教程熊掌号
  • WordPress主题保存网址seo关键词
  • 好公司网站建设价格低seo课程
  • 做的网站如何放在电脑上wordpress 什么值得买 主题
  • 网站顶部广告页游小游戏
  • 小型电子商务网站规划制作网站软件作品
  • 010-58813333 可信网站wordpress显示问题
  • 广州个人做网站达内网站开发培训
  • 手机网站设计机构如何创建博客网站
  • 社区服务呼叫系统 网站的建设怎么接app推广的单子
  • 银川网站建设哪家价格低ui设计工资
  • 宜宾网站设计国外做黄漫的网站
  • 新网站如何做排在前面做网站方面
  • 站长联盟网站漂浮特效
  • 南京哪家网络公司做网站优化好建站系统的应用场景
  • 重庆网站建设技术支持重庆互联网免费注册域名网站推荐
  • python开发做网站哪个网站可以学做包子
  • 番禺做网站的公司深圳市宝安区住房和建设局网站
  • 东营网站开发招聘怎么增加网站首页权重
  • 用阿里云自己建设网站佛山网站建设企划动力
  • 德宏网站制作两学一做纪实评价系统网站