packetfence 7.4集群
1.前提条件
vim /etc/sysctl.conf
添加下面的行:
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
sysctl -p
2.安装
2.1 安装database复制工具
# yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
# sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/percona-release.repo
# yum install percona-xtrabackup socat --enablerepo=percona-release-x86_64
2.2 安装你集群的第一台服务器
# systemctl start packetfence-mariadb 开启安全安装 # mysql_secure_installation
# mysql -u root -p
mysql> CREATE USER 'pfcluster'@'%' IDENTIFIED BY 'aMuchMoreSecurePassword';
mysql> GRANT PROCESS, RELOAD, LOCK TABLES, REPLICATION CLIENT, SUPER ON *.* TO 'pfcluster'@'%';
mysql> CREATE USER 'pfcluster'@'localhost' IDENTIFIED BY 'aMuchMoreSecurePassword';
mysql> GRANT PROCESS, RELOAD, LOCK TABLES, REPLICATION CLIENT, SUPER ON *.* TO 'pfcluster'@'localhost'; mysql> FLUSH PRIVILEGES;
'aMuchMoreSecurePassword' 只是一个示例,你需要自己定义自己的密码
# mysql -u root -p mysql> delete from mysql.user where user = '' ;
mysql> flush privileges;
2.3 服务器配置
net.ipv4.ip_nonlocal_bind = 1
# systemctl disable mariadb
2.4 基础packetfence配置
在配置Network interfaces时,保证在management interface上勾选high availablility
# systemctl restart packetfence-mariadb
在 /etc/sysconfig/network-scripts/ | header 2 |
One Management Interface | ifcfg-YourFirstInterfaceName |
One Registration Interface | ifcfg-YourFirstInterfaceName.YourRegistrationVLANID |
One Isolation Interface | ifcfg-YourFirstInterfaceName.YourIsolationVLANID |
2.5 建立集群
2.5.1 PacketFence配置改变
[database] host=127.0.0.1
[graphite] db_host=127.0.0.1
[active_active] # Change these 2 values by the credentials you've set when configuring MariaDB above
galera_replication_username=pfcluster
galera_replication_password=aMuchMoreSecurePassword
[mysql] host=127.0.0.1
[mysql] host=127.0.0.1
# systemctl restart packetfence-config
# /usr/local/pf/bin/pfcmd configreload hard # systemctl restart packetfence-haproxy
2.5.2 配置cluster.conf
[CLUSTER]
management_ip=192.168.1.10
[CLUSTER interface eth0] ip=192.168.1.10 type=management,high-availability
[CLUSTER interface eth1.2] ip=192.168.2.10 type=internal
[CLUSTER interface eth1.3] ip=192.168.3.10 type=internal
[pf1.example.com] management_ip=192.168.1.5 [pf1.example.com interface eth0] ip=192.168.1.5 type=management,high-availability mask=255.255.255.0 [pf1.example.com interface eth1.2] enforcement=vlan ip=192.168.2.5 type=internal mask=255.255.255.0 [pf1.example.com interface eth1.3] enforcement=vlan ip=192.168.3.5 type=internal mask=255.255.255.0 [pf2.example.com] management_ip=192.168.1.6 [pf2.example.com interface eth0] ip=192.168.1.6 type=management,high-availability mask=255.255.255.0 [pf2.example.com interface eth1.2] enforcement=vlan ip=192.168.2.6 type=internal mask=255.255.255.0 [pf2.example.com interface eth1.3] enforcement=vlan ip=192.168.3.6 type=internal mask=255.255.255.0 [pf3.example.com] management_ip=192.168.1.7 [pf3.example.com interface eth0] ip=192.168.1.7 type=management,high-availability mask=255.255.255.0 [pf3.example.com interface eth1.2] enforcement=vlan ip=192.168.2.7 type=internal mask=255.255.255.0 [pf3.example.com interface eth1.3] enforcement=vlan ip=192.168.3.7 type=internal mask=255.255.255.0
# /usr/local/pf/bin/pfcmd configreload hard # /usr/local/pf/bin/pfcmd checkup
systemctl set-default packetfence-cluster
如果集群新建不成功,可能是因为其他服务器上已经运行了MariaDB服务。请确保其他服务器停止运行mariadb服务,只有第一台服务器上有运行mariadb服务(systemctl stop packetfence-mariadb 和 systemctl stop mariadb)。
# systemctl stop packetfence-mariadb
# /usr/local/pf/bin/pfcmd generatemariadbconfig
# /usr/local/pf/sbin/pf-mariadb --force-new-cluster
最后一条命令不会有返回除非你中断它,所以你新开一个终端连接,重新开始运行packetfence服务。
/usr/local/pf/bin/pfcmd service pf restart
2.6 加入其他两台服务器
2.6.1 webservices配置
[webservices]
user=packet
pass=fence
然后重载配置,重启第一台服务器 httpd.webservices :
# /usr/local/pf/bin/pfcmd configreload hard # /usr/local/pf/bin/pfcmd service httpd.webservices restart
2.6.2 同步其他节点配置
# /usr/local/pf/bin/cluster/sync --from=192.168.1.5 --api-user=packet --api-password=fence
重载配置,并开启该台服务器的webservices
# systemctl restart packetfence-config # /usr/local/pf/bin/pfcmd configreload # /usr/local/pf/bin/pfcmd service haproxy restart # /usr/local/pf/bin/pfcmd service httpd.webservices restart
2.6.3 同步MariaDB
# rm -fr /var/lib/mysql/*
# systemctl restart packetfence-mariadb
mysql> show status like 'wsrep%';
# systemctl start packetfence-mariadb
2.6.4 启动packetfence服务
# /usr/local/pf/bin/pfcmd service pf start
# /usr/local/pf/bin/pfcmd version > /usr/local/pf/conf/currently-at
| 留言与评论(共有 0 条评论) “” |