主机名称 | Ip地址 | 角色 |
503A | 192.168.68.10 | Mysql从 |
503B | 192.168.68.11 | Mysql从,nfs服务端,dns服务端 |
503Cmysql | 192.168.68.12 | MySQL主,web客户端 |
yum install -y unbound
systemctl enable --now unbound
firewall-cmd --add-service=dns --permanent --zone=public
firewall-cmd --reload
2.2 配置/etc/unbound/unbound.conf
interface : 0.0.0.0
port : 53
do-ip4 : yes
do-udp : yes
access-control : 0.0.0.0 allow
module-config : “iterator”
forward-zone:
name: "."
forward-addr:"8.8.8.8"
local-zone: "test.com." static
local-data: "503C.test.com. IN A 192.168.68.12"
local-data-ptr:"192.168.68.12 503C.test.com"
local-data: "503B.test.com. IN A 192.168.68.11"
local-data-ptr:"192.168.68.11 503B.test.com"
local-data: "503A.test.com. IN A 192.168.68.10"
local-data-ptr:"192.168.68.10 503A.test.com"
注释掉:
全部注释,只保留:
nameserver 192.168.68.11
3.1 下载 nfs-utils rpcbind,配置防火墙
检查有没有已下载的nfs或rpcbind,如果有,先卸载,再下载
yum install nfs-utils rpcbind
注:先启动rpc再启动nfs-server
firewall-cmd --add-service=nfs --permanent --zone=public
firewall-cmd --reload
mkdir /webapp/
写入/etc/exports
/webapp/ 503C.test.com(rw,sync,no_root_squash)
3.3 客户端503C挂载,写入/etc/fstab自动挂载
mount -t nfs 192.168.68.11:/webapp/ /var/www/html/
无报错
写入/etc/fstab
192.168.68.11:/webapp/ /var/www/html nfsdefaults,noatime 0 0
yum install -y mysql*
firewall-cmd --add-service=mysql --permanent --zone=public
firewall-cmd --reload
主:
[mysqld]
log_bin = source-bin
server_id = 1
从1:
[mysqld]
server_id = 2
relay_log = relipca-relay
relay_log_index = relipca-relay-index
从2:
[mysqld]
server_id = 3
relay_log = relipca-relay
relay_log_index = relipca-relay-index
在/var/log/mysqld.log找到临时密码,首次进入mysql
设置root的新密码Redhat3~
>alter user root@localhost identified by ‘Redhat3~’;
创建主从同步用户
>create user 'wwp'@'192.168.68.%' identified by 'Redhat3~';
>grant replication slave on *.* to 'wwp'@'192.168.68.%';
>UNLOCK TABLES;
show master status;
进入mysql同上,进入后
mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.02 sec)
mysql> change master to master_host='192.168.68.12',
-> master_user='wwp',master_password='Redhat3~',
-> master_log_file='source-bin.000001',
-> master_log_pos=1852,
-> get_master_public_key=1;
Query OK, 0 rows affected, 9 warnings (0.02 sec)
mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.02 sec)
show slave status\G
5.1 下载httpd php php-fpm php-mydqlnd
yum -y install httpd php php-fpm php-mysdqlnd
5.2 下载git-core php-xml php-json,下载Discuz到挂载目录,配置防火墙,打开权限
yum -y install git-core php-xml php-json
git clone https://gitee.com /Discuz/DiscuzX.git
cp -rf DiscuzX/upload /var/www/html/luntan
chown -R apache /var/www/html/luntan
chmod 755 -R /var/www/html/luntan
firewall-cmd --add-service=httpd --permanent --zone=public
firewall-cmd --reload
setsebool -P httpd_use_nfs 1
setsebool -P httpd_can_network_connect 1
> create database webapp;
> create user webuser@'192.168.68.%' identified with mysql_native_password by 'Redhat1~';
> grant all on webapp.* to webuser@'192.168.68.%';
编写测试连接的php代码
<?php
$servername = "192.168.68.12";
$username = "webuser";
$password = "Redhat1~";
$dbname = "webapp";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn)
echo "failed \n";
else
echo "connect to db \n";
$conn->close();
?>
安装
主数据库:
从数据库: