A présent, nous possédons des machines HA dupliquant les services nécessaires au fonctionnement de notre site d’exemple WordPress.
Nous allons à présent installer le site WordPress en mode HA.
1°) Création User et Database pour WordPress
[root@node01-sqlw ~]# mysql -u root –p Enter password: « Votre mot de passe » MariaDB [(none)]> CREATE DATABASE wordpress; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES on wordpress.* to 'worduser'@'%' IDENTIFIED BY 'MOT DE PASSE'; MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> SELECT User, Host, Password FROM mysql.user;
MariaDB [(none)]> show DATABASES;
Vérifions la réplication des bases et users sur les node02 et node03.
[root@node01-sqlw ~]#mysql -h node02-sqlw -u ClusterCheck -p -e "SELECT User, Host, Password FROM mysql.user;" [root@node01-sqlw ~]# mysql -h node03-sqlw -u ClusterCheck -p -e "SELECT User, Host, Password FROM mysql.user;"
[root@node01-sqlw ~]# mysql -h node02-sqlw -u ClusterCheck -p -e "SHOW DATABASES;" [root@node01-sqlw ~]# mysql -h node03-sqlw -u ClusterCheck -p -e " SHOW DATABASES;"
La réplication User et Tables est opérationnelle.
2°) Installer WordPress. (node03-webw)
[root@node03-webw ~]# cd /home/chris [root@node03-webw chris]# yum install wget tar [root@node03-webw chris]# wget http://wordpress.org/latest.tar.gz
[root@node03- webw chris]# tar xzvf latest.tar.gz [root@node03- webw chris]# cp -avr wordpress /sharegfs/www/ [root@node03- webw chris]# ls -al /sharegfs/www/wordpress/ [root@node03- webw chris]# rm -rf wordpress
Création répertoire Upload des images (node03-webw)
[root@node03- webw chris]# mkdir -p /sharegfs/www/wordpress/wp-content/uploads
Appliquer les changements de droits (node03-webw)
[root@node03- webw chris]# chown -R apache:apache /sharegfs/www/wordpress [root@node03- webw chris]# chmod -R 755 /sharegfs/www/wordpress
Configuration WordPress Mariadb
[root@node03-webw ~]# cd /sharegfs/www/wordpress [root@node03-webw wordpress]# mv wp-config-sample.php wp-config.php [root@node03-webw wordpress]# cp wp-config.php{,.sauv}
[root@node03-webw wordpress]# vi wp-config.php // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wordpress' ); /** MySQL database username */ define( 'DB_USER', 'worduser' ); /** MySQL database password */ define( 'DB_PASSWORD', 'MOT DE PASSE ' ); /** MySQL hostname */ define( 'DB_HOST', 'sqlw.house.cpb' ); /** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' ); /** The Database Collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' );
Configuration WordPress Apache(node03-webw)
[root@node03-webw wordpress]# cd /sharegfs/etc/httpd/conf.d/
[root@node03-webw conf.d]#vi wordpress.conf <VirtualHost *:80> ServerName wordpress.house.cpb ServerAlias house.cpb DocumentRoot /sharegfs/www/wordpress ErrorLog /sharegfs/log/wordpress/error.log CustomLog /sharegfs/log/wordpress/access.log combined DirectoryIndex index.php <Directory /sharegfs/www/wordpress/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
[root@node03-webw ~]# mkdir -p /sharegfs/log/wordpress [root@node01-webw ~]# systemctl reload httpd [root@node02-webw ~]# systemctl reload httpd [root@node03-webw ~]# systemctl reload httpd
3°) Configurer HaProxy pour notre Site wordpress.house.cpb (node02-haw)
[root@node02-haw ~]# vi /sharegfs/etc/haproxy/haproxy.cfg frontend Cluster_web bind *:80 mode http #bloc load Cluster site1 Web acl server_site1 hdr_dom(host) -i site1.house.cpb use_backend ClusterWEB if server_site1 #bloc load Cluster wordpress Web acl server_wordpress hdr_dom(host) -i wordpress.house.cpb use_backend ClusterWEB if server_wordpress description FrontEnd pour le Cluster WEB backend ClusterWEB balance leastconn option httpchk GET /index.php server node01-webw node01-webw:80 check inter 3s fall 3 rise 2 server node02-webw node02-webw:80 check inter 3s fall 3 rise 2 server node03-webw node03-webw:80 check inter 3s fall 3 rise 2
[root@node01-haw ~]# systemctl reload haproxy [root@node02-haw ~]# systemctl reload haproxy [root@node03-haw ~]# systemctl reload haproxy
4°) Configuration de WordPress GUI
« Français »
« installer WordPress »
« Se connecter »
Nous venons d’installer « WordPress » en Mode HA
Views: 7