分片集群

2022-11-27  本文已影响0人  古飞_数据

10/14 20:34

分片集群: sharding cluster:
https://blog.csdn.net/duanbeibei/article/details/89334866

shard节点配置过程

创建目录:

mkdir -p /mongodb/38021/conf /mongodb/38021/log /mongodb/38021/data
mkdir -p /mongodb/38022/conf /mongodb/38022/log /mongodb/38022/data
mkdir -p /mongodb/38023/conf /mongodb/38023/log /mongodb/38023/data
mkdir -p /mongodb/38024/conf /mongodb/38024/log /mongodb/38024/data
mkdir -p /mongodb/38025/conf /mongodb/38025/log /mongodb/38025/data
mkdir -p /mongodb/38026/conf /mongodb/38026/log /mongodb/38026/data

修改配置文件: 21-23 一主一从一ABITER

cat > /mongodb/38021/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38021/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38021/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38021
replication:
  oplogSizeMB: 2048
  replSetName: shl
sharding:
  clusterRole: shardsvr
EOF


cat > /mongodb/38022/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38022/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38022/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38022
replication:
  oplogSizeMB: 2048
  replSetName: shl
sharding:
  clusterRole: shardsvr
EOF

cat > /mongodb/38023/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38023/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38023/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38023
replication:
  oplogSizeMB: 2048
  replSetName: shl
sharding:
  clusterRole: shardsvr
EOF

第二组24-26 一主一从一ABITER

cat > /mongodb/38024/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38024/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38024/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38024
replication:
  oplogSizeMB: 2048
  replSetName: sh2
sharding:
  clusterRole: shardsvr
EOF


cat > /mongodb/38025/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38025/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38025/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38025
replication:
  oplogSizeMB: 2048
  replSetName: sh2
sharding:
  clusterRole: shardsvr
EOF


cat > /mongodb/38026/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38026/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38026/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38026
replication:
  oplogSizeMB: 2048
  replSetName: sh2
sharding:
  clusterRole: shardsvr
EOF

启动6个节点:

mongod -f /mongodb/38021/conf/mongod.conf
mongod -f /mongodb/38022/conf/mongod.conf 
mongod -f /mongodb/38023/conf/mongod.conf
mongod -f /mongodb/38024/conf/mongod.conf
mongod -f /mongodb/38025/conf/mongod.conf
mongod -f /mongodb/38026/conf/mongod.conf

第一组:搭建一主一从一仲裁:

mongo --port 38021 admin
config ={_id:'sh1', members:[
          {_id: 0,host:'192.168.137.5:38021'},
          {_id: 1,host:'192.168.137.5:38022'},
          {_id: 2,host:'192.168.137.5:38023', "arbiterOnly":true } 
]}

db

初始化集群
rs.initiate(config)

第二组:搭建一主一从一仲裁:

mongo --port 38024 admin
config ={_id:'sh2', members:[
          {_id: 0,host:'192.168.137.5:38024'},
          {_id: 1,host:'192.168.137.5:38025'},
          {_id: 2,host:'192.168.137.5:38026', "arbiterOnly":true } 
]}

db

初始化集群
rs.initiate(config)

config节点配置(PSS)

目录创建:
mkdir -p /mongodb/38018/conf /mongodb/38018/log /mongodb/38018/data
mkdir -p /mongodb/38019/conf /mongodb/38019/log /mongodb/38019/data
mkdir -p /mongodb/38020/conf /mongodb/38020/log /mongodb/38020/data

cat > /mongodb/38018/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38018/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38018/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38018
replication:
  oplogSizeMB: 2048
  replSetName: configReplSet
sharding:
  clusterRole: configsvr
EOF


cat > /mongodb/38019/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38019/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38019/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38019
replication:
  oplogSizeMB: 2048
  replSetName: configReplSet
sharding:
  clusterRole: configsvr
EOF

cat > /mongodb/38020/conf/mongod.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38020/log/mongodb.log
  logAppend: true
storage:
  journal:
    enabled: true
  dbPath: /mongodb/38020/data
  directoryPerDB: true 
  #engine: wiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 1
      directoryForIndexes: true
    collectionConfig:
      blockCompressor: zlib
    indexConfig:
      prefixCompression: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38020
replication:
  oplogSizeMB: 2048
  replSetName: configReplSet
sharding:
  clusterRole: configsvr
EOF


启动3个节点:
mongod -f /mongodb/38018/conf/mongod.conf
mongod -f /mongodb/38019/conf/mongod.conf
mongod -f /mongodb/38020/conf/mongod.conf


搭建-一主二从:
mongo --port 38018 admin
config ={_id: 'configReplSet',members: [
        {_id: 0,host:'192.168.137.5:38018'},
        {_id: 1,host:'192.168.137.5:38019'},
        {_id: 2,host:'192.168.137.5:38020'}
]}

db

初始化集群:
rs.initiate(config)

MONGOS节点的创建:

mkdir -p /mongodb/38017/conf /mongodb/38017/log

配置文件创建:
cat > /mongodb/38017/conf/mongos.conf <<EOF
systemLog:
  destination: file
  path: /mongodb/38017/log/mongodb.log
  logAppend: true
processManagement:
  fork: true
net:
  bindIp: 192.168.137.5,127.0.0.1
  port: 38017
sharding:
  configDB: configReplSet/192.168.137.5:38018,192.168.137.5:38019,192.168.137.5:38020
EOF

启动MONGOS:
mongos -f /mongodb/38017/conf/mongos.conf

分片集群添加节点:
mongo 192.168.137.5:38017/admin



ps -ef | grep mongo    -- 有10个进程


分片集群添加节点:
mongo 192.168.137.5:38017/admin

添加分片:
db.runCommand({addshard: "sh1/192.168.137.5:38021,192.168.137.5:38022,192.168.137.5:38023",name:"shard1"})
db.runCommand({addshard: "sh2/192.168.137.5:38024,192.168.137.5:38025,192.168.137.5:38026",name:"shard2"})

列出分片:
db.runCommand({listshards:1})

整体的状态
sh.status();

10/14 22:12

安装mysq|8商业版:
rpm -ivh mysql-router-commercial-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-shell-commercial-8.0.26- 1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-backup- 8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-connector-C++-commercial-8.0.26-1.1.el7.x86_ 64.rpm
rpm -vih mysql-connector-C++-commercial-jdbc-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-connector-C++-commercial-devel-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-connector-java-commercial-8.0.26-1.1.el7.noarch.rpm
rpm -ivh mysql-commercial-common-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-client-plugins-8.0.26-1.1.el7.x86_64.rpm
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
rpm -ivh mysql-commercial- embedded-compat-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-libs-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-libs-compat-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-client-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-server-8.0.26-1.1.el7.x86_64.rpm

--可以不装
rpm -ivh mysql-commercial-devel-8.0.26-1.1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-commercial-test-8.0.26-1.1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-connector-python3-commercial-8.0.26-1.1.el7.x86 64.rpm --nodeps
rpm -ivh mysql-connector-odbc-commercial-8.0.26-1.1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-connector-odbc-commercial-setup-8.0.26-1.1.el7.x86_64.rpm --nodeps ---- 提示报错的话就是UNIXODBC RPM没有安装

systemctl start mysqld.service
systemctl status mysqld.service
ps -ef | grep mysql
pkill 870
tail -100 /var/log/mysqld.log

/var/lib/mysql/ 数据目录

卸载mysql8
rpm -e mysql-commercial-common-8.0.26-1.1.el7.x86_64 --nodeps
rpm -e mysql-commercial-test_8.0.26-1.1.el7.x86_64 --nodeps
rpm -e mysql-connector-c++-commercial-jdbc 8.0.26-1.1.el7.x86 64 --nodeps
rpm -e mysql-commercial-client 8.0.26- 1.1.el7.x86_ 64 --nodeps
rpm -e mysql-connector odbc- commercial-8.0.26-1.1.el7.x86 64 --nodeps
rpm -e mysql-commercial- embedded-compat 8.0.26- 1.1.el7.x86 64
rpm -e mysq|- shell- commercial- 8.0.26- 1.1.el7.x86_ 64
rpm -e mysql-connector-c+ +- commercial-devel 8.0.26- 1.1.el7.x86 64
rpm -e mysql-commercial-server- 8.0.26-1.1.el7.x86_ 64
rpm -e mysql- connector- python3- commercial 8.0.26-1.1.el7.x86 64
rpm -e mysql-commercial-backup- 8.0.26- 1.1.el7.x86_ 64
rpm -e mysq|- connector-java commercial-8.0.26- 1.1.el7.noarch
rpm -e mysql-commercial-libs- 8.0.26-1.1.el7.x86 64
rpm -e mysq|- commercial-libs 8.0.26- 1.1.el7.x86_ 64 -- nodeps
rpm -e mysql- commercial- devel- 8.0.26-1.1.el7.x86 64

rpm -e mysql-connector-C++-commercial-8.0.26-1.1.el7.x86_ 64
rpm -e mysql-commercial-devel -8.0.26-1.1.el7.x86_ 64
rpm -e mysql-connector-C++ -commercial-8.0.26-1.1.el7.x86_ 64
rpm -e mysql-commercial-libs-compat -8.0.26-1.1.el7.x86_ 64
rpm -e mysql-connector-odbc-commercial-setup-8.0.26-1.1.el7.x86_ 64
rpm -e mysql-router-commercial 8.0.26- 1.1.el7.x86_ 64
rpm -e mysql-commercial-client-plugins-8.0.26-1.1.el7.x86_ 64

rpm -qa|grep mysql

service mysqld start
ps -ef | grep mysql
tail -100 /var/log/mysqld.log 找密码

mysql8设置密码策略:
set global validate_password.policy=0;
set global validate_password.length=4;
set global validate_password.check_user_name=OFF;
set global validate_password.number_count=0;

alter user user() identified by "root";

10/14 20:34

分片集群: sharding cluster:
https://blog.csdn.net/duanbeibei/article/details/89334866
shard节点配置过程
创建目录:
mkdir -p /mongodb/38021/conf /mongodb/38021/log /mongodb/38021/data
mkdir -p /mongodb/38022/conf /mongodb/38022/log /mongodb/38022/data
mkdir -p /mongodb/38023/conf /mongodb/38023/log /mongodb/38023/data
mkdir -p /mongodb/38024/conf /mongodb/38024/log /mongodb/38024/data
mkdir -p /mongodb/38025/conf /mongodb/38025/log /mongodb/38025/data
mkdir -p /mongodb/38026/conf /mongodb/38026/log /mongodb/38026/data

修改配置文件: 21-23 一主一从一ABITER

cat > /mongodb/38021/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38021/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38021/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38021
replication:
oplogSizeMB: 2048
replSetName: shl
sharding:
clusterRole: shardsvr
EOF

cat > /mongodb/38022/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38022/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38022/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38022
replication:
oplogSizeMB: 2048
replSetName: shl
sharding:
clusterRole: shardsvr
EOF

cat > /mongodb/38023/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38023/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38023/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38023
replication:
oplogSizeMB: 2048
replSetName: shl
sharding:
clusterRole: shardsvr
EOF

第二组24-26 一主一从一ABITER

cat > /mongodb/38024/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38024/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38024/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38024
replication:
oplogSizeMB: 2048
replSetName: sh2
sharding:
clusterRole: shardsvr
EOF

cat > /mongodb/38025/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38025/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38025/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38025
replication:
oplogSizeMB: 2048
replSetName: sh2
sharding:
clusterRole: shardsvr
EOF

cat > /mongodb/38026/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38026/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38026/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38026
replication:
oplogSizeMB: 2048
replSetName: sh2
sharding:
clusterRole: shardsvr
EOF

启动6个节点:

mongod -f /mongodb/38021/conf/mongod.conf
mongod -f /mongodb/38022/conf/mongod.conf
mongod -f /mongodb/38023/conf/mongod.conf
mongod -f /mongodb/38024/conf/mongod.conf
mongod -f /mongodb/38025/conf/mongod.conf
mongod -f /mongodb/38026/conf/mongod.conf

第一组:搭建一主一从一仲裁:
mongo --port 38021 admin
config ={_id:'sh1', members:[
{_id: 0,host:'192.168.137.5:38021'},
{_id: 1,host:'192.168.137.5:38022'},
{_id: 2,host:'192.168.137.5:38023', "arbiterOnly":true }
]}

db

初始化集群
rs.initiate(config)

第二组:搭建一主一从一仲裁:
mongo --port 38024 admin
config ={_id:'sh2', members:[
{_id: 0,host:'192.168.137.5:38024'},
{_id: 1,host:'192.168.137.5:38025'},
{_id: 2,host:'192.168.137.5:38026', "arbiterOnly":true }
]}

db

初始化集群
rs.initiate(config)

config节点配置(PSS)
目录创建:
mkdir -p /mongodb/38018/conf /mongodb/38018/log /mongodb/38018/data
mkdir -p /mongodb/38019/conf /mongodb/38019/log /mongodb/38019/data
mkdir -p /mongodb/38020/conf /mongodb/38020/log /mongodb/38020/data

cat > /mongodb/38018/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38018/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38018/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38018
replication:
oplogSizeMB: 2048
replSetName: configReplSet
sharding:
clusterRole: configsvr
EOF

cat > /mongodb/38019/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38019/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38019/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38019
replication:
oplogSizeMB: 2048
replSetName: configReplSet
sharding:
clusterRole: configsvr
EOF

cat > /mongodb/38020/conf/mongod.conf <<EOF
systemLog:
destination: file
path: /mongodb/38020/log/mongodb.log
logAppend: true
storage:
journal:
enabled: true
dbPath: /mongodb/38020/data
directoryPerDB: true

engine: wiredTiger

wiredTiger:
engineConfig:
cacheSizeGB: 1
directoryForIndexes: true
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38020
replication:
oplogSizeMB: 2048
replSetName: configReplSet
sharding:
clusterRole: configsvr
EOF

启动3个节点:
mongod -f /mongodb/38018/conf/mongod.conf
mongod -f /mongodb/38019/conf/mongod.conf
mongod -f /mongodb/38020/conf/mongod.conf

搭建-一主二从:
mongo --port 38018 admin
config ={_id: 'configReplSet',members: [
{_id: 0,host:'192.168.137.5:38018'},
{_id: 1,host:'192.168.137.5:38019'},
{_id: 2,host:'192.168.137.5:38020'}
]}

db

初始化集群:
rs.initiate(config)

MONGOS节点的创建:
mkdir -p /mongodb/38017/conf /mongodb/38017/log

配置文件创建:
cat > /mongodb/38017/conf/mongos.conf <<EOF
systemLog:
destination: file
path: /mongodb/38017/log/mongodb.log
logAppend: true
processManagement:
fork: true
net:
bindIp: 192.168.137.5,127.0.0.1
port: 38017
sharding:
configDB: configReplSet/192.168.137.5:38018,192.168.137.5:38019,192.168.137.5:38020
EOF

启动MONGOS:
mongos -f /mongodb/38017/conf/mongos.conf

分片集群添加节点:
mongo 192.168.137.5:38017/admin

ps -ef | grep mongo -- 有10个进程

分片集群添加节点:
mongo 192.168.137.5:38017/admin

添加分片:
db.runCommand({addshard: "sh1/192.168.137.5:38021,192.168.137.5:38022,192.168.137.5:38023",name:"shard1"})
db.runCommand({addshard: "sh2/192.168.137.5:38024,192.168.137.5:38025,192.168.137.5:38026",name:"shard2"})

列出分片:
db.runCommand({listshards:1})

整体的状态
sh.status();

10/14 22:12

安装mysq|8商业版:
rpm -ivh mysql-router-commercial-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-shell-commercial-8.0.26- 1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-backup- 8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-connector-C++-commercial-8.0.26-1.1.el7.x86_ 64.rpm
rpm -vih mysql-connector-C++-commercial-jdbc-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-connector-C++-commercial-devel-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-connector-java-commercial-8.0.26-1.1.el7.noarch.rpm
rpm -ivh mysql-commercial-common-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-client-plugins-8.0.26-1.1.el7.x86_64.rpm
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
rpm -ivh mysql-commercial- embedded-compat-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-libs-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-libs-compat-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-client-8.0.26-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-server-8.0.26-1.1.el7.x86_64.rpm

--可以不装
rpm -ivh mysql-commercial-devel-8.0.26-1.1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-commercial-test-8.0.26-1.1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-connector-python3-commercial-8.0.26-1.1.el7.x86 64.rpm --nodeps
rpm -ivh mysql-connector-odbc-commercial-8.0.26-1.1.el7.x86_64.rpm --nodeps
rpm -ivh mysql-connector-odbc-commercial-setup-8.0.26-1.1.el7.x86_64.rpm --nodeps ---- 提示报错的话就是UNIXODBC RPM没有安装

systemctl start mysqld.service
systemctl status mysqld.service
ps -ef | grep mysql
pkill 870
tail -100 /var/log/mysqld.log

/var/lib/mysql/ 数据目录

卸载mysql8
rpm -e mysql-commercial-common-8.0.26-1.1.el7.x86_64 --nodeps
rpm -e mysql-commercial-test_8.0.26-1.1.el7.x86_64 --nodeps
rpm -e mysql-connector-c++-commercial-jdbc 8.0.26-1.1.el7.x86 64 --nodeps
rpm -e mysql-commercial-client 8.0.26- 1.1.el7.x86_ 64 --nodeps
rpm -e mysql-connector odbc- commercial-8.0.26-1.1.el7.x86 64 --nodeps
rpm -e mysql-commercial- embedded-compat 8.0.26- 1.1.el7.x86 64
rpm -e mysq|- shell- commercial- 8.0.26- 1.1.el7.x86_ 64
rpm -e mysql-connector-c+ +- commercial-devel 8.0.26- 1.1.el7.x86 64
rpm -e mysql-commercial-server- 8.0.26-1.1.el7.x86_ 64
rpm -e mysql- connector- python3- commercial 8.0.26-1.1.el7.x86 64
rpm -e mysql-commercial-backup- 8.0.26- 1.1.el7.x86_ 64
rpm -e mysq|- connector-java commercial-8.0.26- 1.1.el7.noarch
rpm -e mysql-commercial-libs- 8.0.26-1.1.el7.x86 64
rpm -e mysq|- commercial-libs 8.0.26- 1.1.el7.x86_ 64 -- nodeps
rpm -e mysql- commercial- devel- 8.0.26-1.1.el7.x86 64

rpm -e mysql-connector-C++-commercial-8.0.26-1.1.el7.x86_ 64
rpm -e mysql-commercial-devel -8.0.26-1.1.el7.x86_ 64
rpm -e mysql-connector-C++ -commercial-8.0.26-1.1.el7.x86_ 64
rpm -e mysql-commercial-libs-compat -8.0.26-1.1.el7.x86_ 64
rpm -e mysql-connector-odbc-commercial-setup-8.0.26-1.1.el7.x86_ 64
rpm -e mysql-router-commercial 8.0.26- 1.1.el7.x86_ 64
rpm -e mysql-commercial-client-plugins-8.0.26-1.1.el7.x86_ 64

rpm -qa|grep mysql

service mysqld start
ps -ef | grep mysql
tail -100 /var/log/mysqld.log 找密码

mysql8设置密码策略:
set global validate_password.policy=0;
set global validate_password.length=4;
set global validate_password.check_user_name=OFF;
set global validate_password.number_count=0;

alter user user() identified by "root";

上一篇 下一篇

猜你喜欢

热点阅读