Quarter's blog Quarter's blog
首页
  • Java

    • 基础概念于知识
  • 数据库

    • 高性能MySQL读后感
    • Oracle索引入门
  • JVM

    • 深入学习JVM虚拟机
  • Vue
  • leetcode打卡
  • 虚拟机集群搭建
  • 工作中的Oracle
关于
收藏
  • 分类
  • 标签
  • 归档

Quarter

无限进步
首页
  • Java

    • 基础概念于知识
  • 数据库

    • 高性能MySQL读后感
    • Oracle索引入门
  • JVM

    • 深入学习JVM虚拟机
  • Vue
  • leetcode打卡
  • 虚拟机集群搭建
  • 工作中的Oracle
关于
收藏
  • 分类
  • 标签
  • 归档
  • CICD

    • centos集群搭建
      • 配置静态ip、开启网卡
      • 安装数据库12c
      • P1、P2、P3安装NFS
      • 安装docker、swarm、portainer
        • docker
        • docker swarm & portainer
      • 总结
  • 算法

  • 技术
  • CICD
Quarter
2023-04-03
目录

centos集群搭建

# 虚拟机集群搭建

本次搭建集群环境,主要是为了之后研究分布式相关组件,所以记录一下。

系统centos 7 root用户账号密码均为Lyrrrrrrrr

网关为192.168.38.2,虚拟机集群采用VMware搭建

名称 用途 配置 ip
P1 主节点 4c8G 192.168.38.151
P2 工作节点 4c4G 192.168.38.152
P3 工作节点 4c4G 192.168.38.153
database 数据库 oracle的12.2.0.1 数据库密码为Lyrrrrrrrr_ 4c8G 192.168.38.150

# 配置静态ip、开启网卡

cd /etc/sysconfig/network-scripts/

vi ifcfg-ens33

image-20230401234656789

设置DNS服务器

vi /etc/resolv.conf

nameserver 114.114.114.114

service network restart

# 安装数据库12c

CentOS7 MobaXterm 通过X11 Forwarding 图形界面安装oracle12c (opens new window)

CentOS 7 安装 Oracle 12c 最佳实践 (opens new window)

  1. 给centos安装X11相关的依赖

yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-font-utils xorg-x11-fonts-Type1 xclock

vi /etc/ssh/sshd_config

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
X11UseLocalhost no
1
2
3
4
5
6

systemctl restart sshd.service

xhost +

  1. 关闭防火墙并禁止开启启动
systemctl stop firewalld.service 
systemctl disable firewalld.service
#查看防火墙状态
systemctl status firewalld.service
1
2
3
4
  1. 修改Oracle所需要的配置

编辑文件

vi /etc/selinux/config

修改内容如下

SELINUX=disabled
1
  1. 安装对应的依赖
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
1
  1. 修改swap,Oracle 12c好像默认需要16g的swap,但是可以选择忽略冲突

新安装的系统可能出现交换空间不足的情况,这个时候用root用户去配置一下,然后check again

dd if=/dev/zero of=/home/swap bs=1024 count=16400000
mkswap /home/swap
swapon /home/swap
1
2
3
vi /etc/fstab
1

末尾加上 /home/swap swap swap default 0 0

执行 `echo "swapon /home/swap" >> /etc/inittab

  1. 修改系统配置

vi /etc/sysctl.conf

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8329226240
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
1
2
3
4
5
6
7
8
9
10
11

vim /etc/security/limits.conf

oracle soft nproc 65536
oracle hard nproc 65536
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft stack 65536
oracle hard stack 65536
1
2
3
4
5
6
  1. 解压安装包到/home/oracle/database/ 开始安装

执行./runInstaller

选择server class,这个container database可以取消掉的

image-20230402012731690

配置变量环境

su - oracle
vim ~/.bash_profile

# 下面环境变量配置内容,注意每一个路径都仔细检查一下不要错了
export EDITOR=vi
export ORACLE_SID=orclpdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export PATH=/u01/app/oracle/product/12.2.0/dbhome_1/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export PATH=$ORACLE_HOME/bin:$PATH

# 执行命令使环境变量生效
source ~/.bash_profile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

复制初始化文件

cp /u01/app/oracle/admin/orcl/pfile/init.ora.312023133628 /u01/app/oracle/product/12.2.0/dbhome_1/dbs/initorclpdb.ora
1

允许sys远程连接

orapwd file=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/orapwORCLPDB force=y

Lyrrrrrrrr_

  1. 启动
lsnrctl start
sqlplus / as sysdba
startup;

#不小心装成了PDB模式
#启动的时候还需要
SELECT name, open_mode FROM v$pdbs ORDER BY name;
ALTER PLUGGABLE DATABASE orclpdb OPEN READ WRITE;
1
2
3
4
5
6
7
8

# P1、P2、P3安装NFS

服务端执行这些命令

yum -y install nfs-utils rpcbind
mkdir -p /data/share
chmod 777 /data/share
vi /etc/exports
/data/share *(rw,sync,no_root_squash)
exportfs -r
systemctl start rpcbind
systemctl start nfs-server.service
systemctl enable rpcbind
systemctl enable nfs-server.service
showmount -e localhost
1
2
3
4
5
6
7
8
9
10
11

客户端

yum -y install rpcbind
yum install nfs-utils -y
systemctl enable rpcbind
mkdir -p /data/share

mount -t nfs 192.168.38.151:/data/share /data/share -o nolock,nfsvers=3,vers=3
#自动挂载
vi /etc/fstab
192.168.38.151:/data/share /data/share  nfs defaults 0 0

vi /etc/rc.d/rc.local
mount -t nfs 192.168.38.151:/data/share /data/share -o nolock,nfsvers=3,vers=3
chmod a+x /etc/rc.local
chmod a+x /etc/rc.d/rc.local
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# 安装docker、swarm、portainer

安装脚本不外传。

# docker

上传install-docker 到每个节点的/opt目录下,

执行./install.sh

# docker swarm & portainer

上传install-swam到主节点的/opt目录下

修改host文件,将每个节点的ip root用户 root密码填上。最后一行要空行

然后执行chmod 777 *

./install.sh

portainer 的版本已经升级为2.17.1的ce版本

等待脚本安装完毕,访问主节点的ip:9000即可访问portainer

# 总结

本次遇到一些坑

  • portainer版本太旧了,部署的的时候遇到一些奇怪的错误。例如X509 证书验证。并且在add stack的时候,显示使用docker compose部署,只支持version2的格式。
  • 拉镜像很慢,有两个原因
    • DNS解析慢 编辑/etc/resolv.conf设置DNS服务器,设置完ping www.baidu.com,看看解析的时间是否正常
    • 拉不了镜像 配置了其他的docker源国内镜像地址
#分布式#集群
上次更新: 2023/04/10, 17:41:57
训练营Day1-704. 二分查找&27. 移除元素

训练营Day1-704. 二分查找&27. 移除元素→

最近更新
01
训练营Day13
06-23
02
训练营Day11
06-22
03
训练营Day10
06-22
更多文章>
Theme by Vdoing | Copyright © 2023-2023 Quarter | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式