• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Scalable WordPress on HP Cloud With GlusterFS & Nginx

By Abhishek Ghosh May 10, 2015 6:09 am Updated on May 10, 2015

Scalable WordPress on HP Cloud With GlusterFS & Nginx

Advertisement

Here are the Steps For Building Scalable WordPress on HP Cloud With GlusterFS and Nginx. With OpenStack Nova We Can Just Do it From Desktop. Previously, we wrote about GlusterFS. You possibly love to read Distributed Replicated Block Device. These are the theoretical part. This scalable WordPress instance will have MariaDB (a MySQL fork) database server, GlusterFS distributed filesystem, Nginx or Nginx Plus web servers. We can use Nginx as load balancer too But we can use the load balancer of HP Cloud as good alternative. In the fronted, Akamai DNS (via HP Cloud) will highly cache most commonly visited webpages plus decrease the chance of DDoS. There are different type of scaling – vertical and horizontal are the commonest types.

 

Scalable WordPress on HP Cloud With GlusterFS & Nginx

 

If you are new to HP Cloud and / or OpenStack, you can read how to install WordPress on HP Cloud. With OpenStack Python Client Commands, frankly we can build the instances from command line from Desktop, without opening the Web GUI on browser. If you are not easy with the Python clients, then use the Web GUI. We are starting after setting the Router, Ingress and Egress policy rightly. Instances are running Ubuntu 14.04 LTS.

 

Steps For Creating Scalable WordPress on HP Cloud With GlusterFS & Nginx

 

We can make the MariaDB to replicate on two server instances as well. This is called MySQL Cluster Replication and you will get reference on official MySQL website. InnoDB Storage Engine is commonly used by both Rackspace and us. We use MySQL tuner of Major Hayden to optimize the configuration and setup. What we are doing is known as “MySQL Master-Master Replication”. This is kind of an example blueprint :

Advertisement

---

Scalable WordPress on HP Cloud With GlusterFS & Nginx

Vim
1
2
3
4
apt update -y && apt upgrade
dpkg-reconfigure locales
# en_GB, UTF-8
apt-get install mariadb-server mariadb-client

Edit /etc/my.cnf file :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
bind-address = 0.0.0.0
server-id = <any number>
log-bin = /var/log/mysql/var/bin.log
log-slave-updates
log-bin-index = /var/log/mysql/log-bin.index
log-error = /var/log/mysql/error.log
relay-log = /var/log/mysql/relay.log
relay-log-info-file = /var/log/mysql/relay-log.info
relay-log-index = /var/log/mysql/relay-log.index
auto_increment_increment = 10
auto_increment_offset = 1
master-host = <subnet mask>
master-user = <username>
master-password = <password>
 
replicate-do-db = <database name to be replicated>

You will do the same on another server. You need to run this format of comand on each server :

Vim
1
2
3
4
# mysql -u root -h localhost -p
grant replication slave on *.* to slave@'<subnet mask>' identified by '<password>';
flush privileges;
exit;

We can add both of these database IP on WordPress using HyperDB Plugin from WordPress later. There is software named “Tungsten Replicator” in case you want to do more than the above. Restart the service on both servers, create a database for WordPress :

Vim
1
2
3
CREATE DATABASE wordpress;
mysql -uroot -p<mysql_password> -e "CREATE USER 'wordpress_user'@'%' IDENTIFIED BY '<mysql_password>'";
mysql -uroot -p<mysql_password> -e "GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'%'";

Check the replication and troubleshoot it if needed.

For creation of web server, we can use multiple web servers – 4 or more. We need to configure them in this way. First /etc/hosts should be rightly configured, like we need this entry for proper setup from DNS –

Vim
1
2
15.16.17.18server.example.comgluster1
# 15.16.17.19server1.example.comgluster2

Vim
1
2
3
4
5
6
7
8
9
10
11
12
apt update -y && apt upgrade
apt-get install -y python-software-properties
add-apt-repository -y ppa:gluster/glusterfs-3.5
apt update -y && apt-get install -y glusterfs-server
# check the command rightly
gluster peer probe gluster1
gluster peer status
# check the mounting
mkdir -p /mnt/gluster
# create another server named gluster2
gluster  volume create datapoint replica 2 transport tcp  gluster1:/mnt/gluster  gluster2:/mnt/gluster force
gluster volume start datapoint

Then we will proceed to install Nginx-PHP5 FPM :

Vim
1
2
3
4
5
6
7
8
apt-get update
apt-get -y install nginx glusterfs-client php5-fpm php5-mysql
# CGI path fix
# sed -i s/\;cgi\.fix_pathinfo\=1/cgi\.fix_pathinfo\=0/g /etc/php5/fpm/php.ini
mkdir -p /mnt/gluster
# example
mount -t glusterfs gluter_node_subnet_mask_ip:/file_store mnt/gluster;
echo "gluter_node_subnet_mask_ip:/file_store mnt/gluster glusterfs defaults,_netdev 0 0" >> /etc/fstab

We will install WordPress on mnt/gluster/www, right? You can change the path name.

Vim
1
mkdir mnt/gluster/www

Settings of nginx default will go like this :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /gluster/www;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                
        }
 
 
}

We are using unix socket for PHP5-fpm. TCP will be slower but easy to configure. We need a clean server running Nginx in front because we can add these on /etc/nginx/sites-available/default :

Vim
1
2
3
4
5
upstream backend  {
    ip_hash;
    server node_1_subnet_ip
    server node_2_subnet_ip
}

This one’s IP will go to DNS. If you are new, it will take a bit time to getting a fully working setup within half an hour. One server, two server configuration can be guided easily. For multiple servers, it becomes a bit difficult to guide step by step. Making the concept clear is most important point. We can create HA cluster with Heartbeat Pacemaker.

Tagged With nginx in front of gluster
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Scalable WordPress on HP Cloud With GlusterFS & Nginx

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

  • Install WordPress on Nginx With HHVM on Ubuntu Cloud Server

    Here is Step by Step Guide to Install WordPress on Nginx With HHVM on Ubuntu Cloud Server. This simple and most easy standalone HHVM only guide. We talked about HipHop Virtual Machine or HHVM in order article. Normally, with Nginx, we use PHP5-FPM. This guide is how to install WordPress on Nginx with HHVM on […]

  • How to Install WordPress : Ubuntu 16.04, Nginx, PHP7-FPM

    Here is Step by Step Guide on How to Install WordPress on Ubuntu 16.04, Nginx, PHP7-FPM, memcached & Percona MySQL 5.7 on Cloud Server or VPS.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Market Segmentation in BriefSeptember 20, 2023
  • What is Booting?September 18, 2023
  • What is ncurses?September 16, 2023
  • What is JTAG in Electronics?September 15, 2023
  • iPhone 15 Pro Max Vs Samsung Galaxy S22/S23 UltraSeptember 14, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy