【国产数据库】GBase学习② - 配置调整
1.配置主机名映射
配置三个节点的 IP 主机名映射
编辑三个节点的 hosts 文件
# vi /etc/hosts
将以下三行信息追加到 hosts 文件中
192.168.56.199 gbase8c_private
192.168.56.200 gbase8c_1
192.168.56.201 gbase8c_2
192.168.56.202 gbase8c_3
2.创建 DBA 用户
每个节点都要创建 DBA 用户
# useradd gbase
# passwd gbase
3.为DBA用户配置权限
添加gbase 用户至sudoer 列表,三个节点都要执行如下操作:
# visudo
#打开 sudoer 配置文件,找到 “root ALL=(ALL) ALL” 行,在下方增加
“gbase ALL=(ALL) NOPASSWD:ALL”
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
gbase ALL=(ALL) NOPASSWD:ALL
4.配置gbase用户ssh互信
每个节点都要执行以下命令:
(1) 切换到 gbase 用户下
# su - gbase
(2) 创建秘钥目录和必要的授权
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
(3) 生成秘钥文件(连续回车即可)
$ ssh-keygen -t rsa
(4) 将公钥文件上传至其他节点即可实现免密登录:
此操作需输入 gbase 的密码,所有节点都要执行——
$ ssh-copy-id gbase@192.168.56.199
$ ssh-copy-id gbase@192.168.56.200
$ ssh-copy-id gbase@192.168.56.201
$ ssh-copy-id gbase@192.168.56.202
$ echo 'StrictHostKeyChecking no' >> ~/.ssh/config; echo 'UserKnownHostsFile ~/.ssh/known_hosts' >> ~/.ssh/config; chmod 644 ~/.ssh/config
5.配置系统时间同步
(1) 主安装节点(192.168.56.200)作为 server
执行
$ vi /etc/ntp.conf
打开 NTP 服务配置文件,修改如下:
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 192.168.56.200 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 127.127.1.0
Fudge 127.127.1.0 stratum 10
ntp.conf 文件存盘退出后,执行
$ sudo service ntpd start # 启动NTP服务
$ sudo chkconfig ntpd on # 设置 NTP 服务开机自启
(2) 修改数据节点一(192.168.56.201)NTP 配置
执行
$ vi /etc/ntp.conf
打开 NTP 服务配置文件,修改如下:
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 192.168.56.201 nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 192.168.56.200
Fudge 192.168.56.200 stratum 10
ntp.conf 文件存盘退出后,执行
$ sudo service ntpd start # 启动NTP服务
$ sudo chkconfig ntpd on # 设置 NTP 服务开机自启