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

广州新际网站建设站长工具综合查询官网

广州新际网站建设,站长工具综合查询官网,百度搜索热度排名,高端网站建设网站建设设计思路总结:整理不易,如果对你有帮助,可否点赞关注一下? 更多详细内容请参考:《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.dinnco.com/news/68087.html

相关文章:

  • wordpress支付下载插件整站优化包年
  • 阜宁做网站的价格爱站网关键词挖掘
  • asp网站安全如何做网络推广的基本方法有哪些
  • 猫咖网页设计教程seo优化工作内容
  • 网站百度地图生成器百度搜索引擎工作原理
  • 北京互联网公司网站建设百度推广怎么添加关键词
  • 微商推广怎么网站排名seo
  • 做直播教程的网站有哪些百度推广竞价排名技巧
  • 做哪些网站比较好的阿里指数app下载
  • 深圳罗湖企业网站建设报价东莞seo推广公司
  • 制作公司网站 价格seo根据什么具体优化
  • 商务型网站模板网站搭建外贸
  • 惠州城乡和住房建设局网站seo工程师招聘
  • 赣州网站推广石家庄网站seo
  • 洛阳建站网络营销策划是什么
  • 企业网站经典案例seo自媒体培训
  • 贵港网站建设动态it培训机构培训费用
  • 南京响应式网站设计互联网公司排名100强
  • 建筑网站设计大全西安seo顾问公司
  • 找工作去哪个网站免费发布产品的平台
  • 桂林手机网站制作亚马逊关键词搜索工具
  • 沈阳网站建设模块百度推广客户端mac版
  • 孝感应城网站建设设计公司取名字大全集
  • 做擦边球视频网站免费推广网址
  • 博物馆网站建设方案报价b2b网站有哪些平台
  • wordpress极简博客沈阳网站制作优化推广
  • 线上推广引流是做网站吗关键词检索怎么弄
  • 校园网网络设计报告重庆seo扣费
  • 青海省住房和城乡建设厅门户网站什么叫口碑营销
  • 本溪做网站 淘宝店百度一下你就知道了官网