August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

IP address with ifconfig and sed

Well, my new favorite approach is to pipe ifconfig into a single sed command 🙂

ifconfig | sed -n -e ‘s/:127\.0\.0\.1 //g’ -e ‘s/ *inet addr:\([0-9.]\+\).*/\1/gp’

 

So, how does it work? Well, there are two filters (aka scripts, ie the parameters after the -e flags). The first one, s/:127\.0\.0\.1 //g', simply strips out all occurrences of the local loopback address (127.0.0.1) – this can be left out if you want to include the loopback address in the results. And the second filter, 's/ *inet addr:\([0-9.]\+\).*/\1/gp' matches all lines with IP addresses, strips all but the IP address itself, and prints the matching line (note the ‘p‘ at the end of the filter, which works in with the -nflag at the stared of the sed command).

Obviously that explanation is only meant to be a brief summary. You should consult the sed manual is you’re still unsure of how / why this works… or post a question below 🙂

Just for comparison, here’s some examples of how others do the same thing:

    • Read UNIX/Linux system IP address in a shell script
      ifconfig | grep ‘inet addr:’| grep -v ‘127.0.0.1’ |
      cut -d: -f2 | awk ‘{ print $1}’

      Notice that this one uses an incorrect loopback filter ('127.0.0.1' should be ':127\.0\.0\.1 ') and yet my new favorite is still shorter 😉

    • Parsing IP Address from ifconfig
      ifconfig eth0 | grep “inet” | awk ‘{print $2}’ | awk -F: ‘{print $2}’

      Pretty reasonable, but two more pipes than mine 🙂

    • Setting up a 6to4 IPv6 tunnel with Debian
      ifconfig $EXTIF | grep ‘inet addr’ | cut -d : -f2 | cut -d ‘ ‘ -f1

      This is almost identical to how I used to do it – before I became familiar with sed ;)

 

  • Advance (sic) Linux commands

    ifconfig | grep -vw inet6 | grep -w inet | cut -d : -f 2 | cut -d \ -f 1

    Ok, but a little bit redundant.

  • ifconfig eth0 and awk and grep

    ifconfig eth0 | head -n 2 \
    | sed ‘N;s/\n/ /;N;s/\n/ /’ | awk ‘{print $7 ” ” $9 ” ” $5}’ \
    | sed -e ‘s/addr://g’ -e ‘s/Mask://g’

 

 

Yum to configure multiple master cluster MariaDB Galera

Yum to configure multiple master cluster MariaDB Galera
Hereinafter, if the command is not preceded by PS1 is to represent the three nodes are required to perform the same action, if it means the implementation of the action on the specified node

cluster1.rmohan.com       Centos6.7   192.168.1.60    MariaDB
cluster2.rmohan.com       Centos6.7   192.168.1.62    MariaDB
cluster3.rmohan.com       Centos6.7   192.168.1.63    MariaDB

Hereinafter, if the command is not preceded by PS1 is to represent the three nodes are required to perform the same action, if it means the implementation of the action on the specified node
1, install ntpdate to set timing on node cluster1 cluster2 cluster3 each other synchronization and ssh
yum install -y ntpdate  openssh-askpass openssh-client* wget
echo “*/5 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1” >> /var/spool/cron/root
/usr/sbin/ntpdate pool.ntp.org
cat >> /etc/hosts << EOF
192.168.1.60  cluster1.rmohan.com  cluster1
192.168.1.62  cluster2.rmohan.com  cluster2
192.168.1.63  cluster3.rmohan.com  cluster3
EOF
Here is the production of a key ###
ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P ”
### The following are performed on each node, so that the public key of the machine onto the other nodes
awk ‘{if ($0!~/'”$(hostname)”‘|localhost/)print $NF}’ /etc/hosts |xargs -i ssh-copy-id -i ~/.ssh/id_rsa.pub root@{}
2, installed base build environment
Add EPEL Repository which is provided from Fedora project.
yum -y install epel-release
# set [priority=5]
sed -i -e “s/\]$/\]\npriority=5/g” /etc/yum.repos.d/epel.repo
# for another way, change to [enabled=0] and use it only when needed
sed -i -e “s/enabled=1/enabled=0/g” /etc/yum.repos.d/epel.repo
# if [enabled=0], input a command to use the repository
yum –enablerepo=epel install [Package]
Add RPMforge Repository which provides many useful packages.
yum -y install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
# set [priority=10]
sed -i -e “s/\]$/\]\npriority=10/g” /etc/yum.repos.d/rpmforge.repo
# for another way, change to [enabled=0] and use it only when needed
sed -i -e “s/enabled = 1/enabled = 0/g” /etc/yum.repos.d/rpmforge.repo
# if [enabled=0], input a command to use the repository
yum –enablerepo=rpmforge install [Package]
rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm
rpm –import http://mirrors.dwhd.org/epel/RPM-GPG-KEY-EPEL-6
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm –import http://mirrors.dwhd.org/repoforge/RPM-GPG-KEY.dag.txt
yum clean all && yum makecache
yum groupinstall “Development tools” “Server Platform Development” -y
yum install libxml2-devel lz4 lz4-devel libpcap nmap lsof socat -y
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5.46/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

[root@cluster1 ~]# cat /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
[root@cluster1 ~]# scp /etc/yum.repos.d/mariadb.repo root@cluster2:/etc/yum.repos.d/
mariadb.repo                                                                                                                                                              100%  138     0.1KB/s   00:00
[root@cluster1 ~]# scp /etc/yum.repos.d/mariadb.repo root@cluster3:/etc/yum.repos.d/
mariadb.repo                                                                                                                                                              100%  138     0.1KB/s   00:00

[root@cluster1 ~]# yum install MariaDB-Galera-server MariaDB-client galera -y
[root@cluster2 ~]# yum install MariaDB-Galera-server MariaDB-client galera -y
[root@cluster3 ~]# yum install MariaDB-Galera-server MariaDB-client galera -y

[root@cluster1 ~]# service mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL….. SUCCESS!

/usr/bin/mysqladmin -u root password ‘test123’
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user.  If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer ‘n’.
Change the root password? [Y/n] n
… skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
… Success!
Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
… Success!
Cleaning up…
All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@cluster2 ~]# service mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL….. SUCCESS!
/usr/bin/mysqladmin -u root password ‘test123’
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user.  If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer ‘n’.
Change the root password? [Y/n] n
… skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
… Success!
Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
… Success!
Cleaning up…
All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@cluster3 ~]# service mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL….. SUCCESS!
/usr/bin/mysqladmin -u root password ‘test123’
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we’ll need the current
password for the root user.  If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer ‘n’.
Change the root password? [Y/n] n
… skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
… Success!
Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
… Success!
By default, MariaDB comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
… Success!
Cleaning up…
All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
CLUSTER1
mysql -u root -ptest123 <<< “USE mysql;
GRANT ALL PRIVILEGES ON *.* TO ‘cluster’@’%’ IDENTIFIED BY ‘test123’ WITH GRANT OPTION;
FLUSH PRIVILEGES;”
mysql -u root -ptest123 <<< “USE mysql;
SELECT USER,PASSWORD,HOST FROM user;”
CLUSTER2
mysql -u root -ptest123 <<< “USE mysql;
GRANT ALL PRIVILEGES ON *.* TO ‘cluster’@’%’ IDENTIFIED BY ‘test123’ WITH GRANT OPTION;
FLUSH PRIVILEGES;”
mysql -u root -ptest123 <<< “USE mysql;
SELECT USER,PASSWORD,HOST FROM user;”
CLUSTER3
mysql -u root -ptest123 <<< “USE mysql;
GRANT ALL PRIVILEGES ON *.* TO ‘cluster’@’%’ IDENTIFIED BY ‘test123’ WITH GRANT OPTION;
FLUSH PRIVILEGES;”
mysql -u root -ptest123 <<< “USE mysql;
SELECT USER,PASSWORD,HOST FROM user;”
 modify the configuration of three nodes
####cluster1####
[root@cluster1 ~]# sed -ne ‘/\[mariadb-10.0\]/,//p’ /etc/my.cnf.d/server.cnf
[mariadb-10.0]
query_cache_size=0
binlog_format=ROW
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://192.168.1.62,192.168.1.63
wsrep_cluster_name=’cluster1′
wsrep_node_address=’192.168.1.60′
wsrep_node_name=’cluster1′
wsrep_sst_method=rsync
wsrep_sst_auth=root:password
[root@cluster1 my.cnf.d]# ls
mysql-clients.cnf  server.cnf  tokudb.cnf
[root@cluster1 my.cnf.d]# cat^C
[root@cluster1 my.cnf.d]# /etc/init.d/mysql bootstrap
Bootstrapping the cluster.. Starting MySQL…. SUCCESS!
####cluster2####
[root@cluster2 ~]# sed -ne ‘/\[mariadb-10.0\]/,//p’ /etc/my.cnf.d/server.cnf
[mariadb-10.0]
query_cache_size=0
binlog_format=ROW
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://192.168.1.60,192.168.1.63
wsrep_cluster_name=’cluster1′
wsrep_node_address=’192.168.1.62′
wsrep_node_name=’cluster2′
wsrep_sst_method=rsync
wsrep_sst_auth=root:password
####cluster3####
[root@cluster3  ~]# sed -ne ‘/\[mariadb-10.0\]/,//p’ /etc/my.cnf.d/server.cnf
[mariadb-10.0]
query_cache_size=0
binlog_format=ROW
default_storage_engine=innodb
innodb_autoinc_lock_mode=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://192.168.1.60,192.168.1.62
wsrep_cluster_name=’cluster1′
wsrep_node_address=’192.168.1.63′
wsrep_node_name=’cluster3′
wsrep_sst_method=rsync
wsrep_sst_auth=root:password
[root@cluster1 my.cnf.d]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.46-MariaDB-wsrep MariaDB Server, wsrep_25.12.r4f81026
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> create database mohan;
Query OK, 1 row affected (0.02 sec)
MariaDB [(none)]> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mohan              |
| mysql              |
| performance_schema |
| test               |
+——————–+
5 rows in set (0.00 sec)
MariaDB [(none)]> drop databases test;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘databases test’ at line 1
MariaDB [(none)]> drop database test;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]>
root@cluster2 my.cnf.d]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.46-MariaDB-wsrep MariaDB Server, wsrep_25.12.r4f81026
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mohan              |
| mysql              |
| performance_schema |
| test               |
+——————–+
5 rows in set (0.00 sec)
MariaDB [(none)]> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mohan              |
| mysql              |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@cluster3 my.cnf.d]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.46-MariaDB-wsrep MariaDB Server, wsrep_25.12.r4f81026
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mohan              |
| mysql              |
| performance_schema |
| test               |
+——————–+
5 rows in set (0.00 sec)
MariaDB [(none)]> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mohan              |
| mysql              |
| performance_schema |
+——————–+
4 rows in set (0.00 sec)
MariaDB [(none)]> quit
Bye

CentOS – ssh-copy-id: command not found

CentOS - ssh-copy-id: command not found 
yum -y install openssh-clients

multi-master MariaDB Galera Cluster

CentOS 6.7 Linux compilation configure a multi-master MariaDB Galera Cluster for HA.

Multi-master MariaDB Galera Cluster

Summary
Galera is essentially a wsrep provider (provider), relies on the wsrep API interface. Wsrep API defines a set of applications and replication callback call library to implement transaction database synchronization write set (writeset) replication, and similar applications. The purpose is to achieve the abstract, isolated copied from the application details. While the main objective of the interface is based on the certification of multi-master replication, but the same applies to asynchronous and synchronous master-slave replication.
Personal feeling MariaDB Galera across the room to do a multi-master is still very convenient, than direct shots from good use MySQL. Like with other clusters, in order to avoid node split brain and destroy data, we recommend a minimum Galera Cluster add three nodes. Galera Cluster in the case of high concurrency, may occur when multiple simultaneous write transaction main conflict, this time only one transaction request will be successful, all others failed. You can write / update fails, the automatic retry, and then returns the result. Node status of each node is equal, there is no primary and secondary, to read any one node effect is the same. Can actually fit VIP / LVS or HA uses to achieve high availability. If all the machines in the cluster restart, such as room off, the first start of the server must be started with an empty address.
Galera Cluster is a set of synchronous multi-master MySQL replication cluster solution, easy to use, there is no single point of failure, high availability, can be very good at all times to ensure the safety and the expansion of our data when business is growing.
First, compile and install MariaDB Galera Here to talk about multi-master cluster

cluster1.rmohan.com       Centos6.7   192.168.1.60    MariaDB
cluster2.rmohan.com       Centos6.7   192.168.1.62    MariaDB
cluster3.rmohan.com       Centos6.7   192.168.1.63    MariaDB

Hereinafter, if the command is not preceded by PS1 is to represent the three nodes are required to perform the same action, if it means the implementation of the action on the specified node

1, install ntpdate to set timing on node cluster1 cluster2 cluster3 each other synchronization and ssh

yum install -y ntpdate
yum install openssh-askpass -y
yum -y install openssh-client

echo “*/5 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1″ >> /var/spool/cron/root

/usr/sbin/ntpdate pool.ntp.org

cat >>/etc/hosts<< EOF
192.168.1.60  cluster1.rmohan.com  cluster1
192.168.1.62  cluster2.rmohan.com  cluster2
192.168.1.63  cluster3.rmohan.com  cluster3
EOF

Here is the production of a key ###

ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P ”
### The following are performed on each node, so that the public key of the machine onto the other nodes
awk ‘{if ($0!~/'”$(hostname)”‘|localhost/)print $NF}’ /etc/hosts |xargs -i ssh-copy-id -i ~/.ssh/id_rsa.pub root@{}

2, installed base build environment

Add EPEL Repository which is provided from Fedora project.
yum -y install epel-release
# set [priority=5]

sed -i -e “s/\]$/\]\npriority=5/g” /etc/yum.repos.d/epel.repo
# for another way, change to [enabled=0] and use it only when needed
sed -i -e “s/enabled=1/enabled=0/g” /etc/yum.repos.d/epel.repo
# if [enabled=0], input a command to use the repository
yum –enablerepo=epel install [Package]

Add RPMforge Repository which provides many useful packages.

yum -y install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
# set [priority=10]
sed -i -e “s/\]$/\]\npriority=10/g” /etc/yum.repos.d/rpmforge.repo
# for another way, change to [enabled=0] and use it only when needed
sed -i -e “s/enabled = 1/enabled = 0/g” /etc/yum.repos.d/rpmforge.repo
# if [enabled=0], input a command to use the repository
yum –enablerepo=rpmforge install [Package]

rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm
rpm –import http://mirrors.dwhd.org/epel/RPM-GPG-KEY-EPEL-6
rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm –import http://mirrors.dwhd.org/repoforge/RPM-GPG-KEY.dag.txt

yum clean all && yum makecache
yum groupinstall “Development tools” “Server Platform Development” -y
yum install libxml2-devel lz4 lz4-devel libpcap nmap lsof socat -y

3, Node1 compile install MariaDB Galera

### Download Source Package cmake
[root@cluster1 ~]# wget http://cmake.org/files/v3.4/cmake-3.4.0-rc1.tar.gz
### Download mariadb-galera source package
[root@cluster1 ~]#  wget http://mirrors.dwhd.org/SQL/MariaDB/mariadb-galera-10.0.21/source/mariadb-galera-10.0.21.tar.gz
### Download Source Package kytea
[root@cluster1 ~]# wget http://www.phontron.com/kytea/download/kytea-0.4.7.tar.gz
### Will cmake, mariadb-galera, kytea Source Package spread to other nodes

[root@cluster1 ~]#  awk ‘{if ($0!~/'”$(hostname)”‘|localhost/)print $NF}’ /etc/hosts |xargs -i scp cmake-3.4.0-rc1.tar.gz mariadb-galera-10.0.21.tar.gz kytea-0.4.7.tar.gz root@{}:/root

3, Cluster1 compile install MariaDB Galera

### Compile and install cmake
[root@cluster1 ~]# tar xf cmake-3.4.0-rc1.tar.gz
[Root @ cluster1 ~] # cd cmake-3.4.0-rc1
[root@cluster1 cmake-3.4.0-rc1]# ./bootstrap
[root@cluster1 cmake-3.4.0-rc1]# make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ../
### Compiler installation kytea
[root@cluster1 ~]# tar xf kytea-0.4.7.tar.gz
[root@cluster1 ~]# cd kytea-0.4.7/
[root@cluster1 ~/kytea-0.4.7]# ./configure && make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ..
### Installation Galera
[root@cluster1 ~]# rpm –import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
[root@cluster1 ~]# rpm -ivh http://mirrors.dwhd.org/SQL/MariaDB/mariadb-galera-10.0.21/galera-25.3.9/rpm/galera-25.3.9-1.rhel6.el6.x86_64.rpm
http://mirrors.dwhd.org/SQL/MariaDB/mariadb-galera-10.0.21/galera-25.3.9/rpm/galera-25.3.9-1.rhel6.el6.x86_64.rpm
### Compile and install MariaDB Galera
[root@cluster1 ~]# mkdir -p /data/mariadb-galera-10.0.21
[root@cluster1 ~]# chown -R mysql.mysql /data/mariadb-galera-10.0.21
[root@cluster1 ~]# tar -xvf mariadb-galera-10.0.21.tar.gz
[root@cluster1 ~]# cd mariadb-10.0.21/
[root@cluster1 ~/mariadb-10.0.21]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DMYSQL_DATADIR=/data/mariadb-galera-10.0.21 \
-DWITH_SSL=system -DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_SPHINX_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all \
-DWITH_EMBEDDED_SERVER=1 -DWITH_READLINE=1 -DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_WSREP=1 -DWITH_INNODB_DISALLOW_WRITES=1
[root@cluster1 ~/mariadb-10.0.21]# make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ..
[root@cluster1 ~]#

4, cluster2 compile install MariaDB Galera
### Compile and install cmake
[root@cluster2 ~]# tar xf cmake-3.4.0-rc1.tar.gz
[Root @ cluster2 ~] # cd cmake-3.4.0-rc1
[root@cluster2 cmake-3.4.0-rc1]# ./bootstrap
[root@cluster2 cmake-3.4.0-rc1]# make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ../
### Compiler installation kytea
[root@cluster2 ~]# tar xf kytea-0.4.7.tar.gz
[root@cluster2 ~]# cd kytea-0.4.7/
[root@cluster2 ~/kytea-0.4.7]# ./configure && make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ..
### Installation Galera
[root@cluster2 ~]# rpm –import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
[root@cluster2 ~]# rpm -ivh http://mirrors.dwhd.org/SQL/MariaDB/mariadb-galera-10.0.21/galera-25.3.9/rpm/galera-25.3.9-1.rhel6.el6.x86_64.rpm
http://mirrors.dwhd.org/SQL/MariaDB/mariadb-galera-10.0.21/galera-25.3.9/rpm/galera-25.3.9-1.rhel6.el6.x86_64.rpm
### Compile and install MariaDB Galera
[root@cluster2 ~]# mkdir -p /data/mariadb-galera-10.0.21
[root@cluster2 ~]# chown -R mysql.mysql /data/mariadb-galera-10.0.21
[root@cluster2 ~]# tar -xvf mariadb-galera-10.0.21.tar.gz
[root@cluster2 ~]# cd mariadb-10.0.21/
[root@cluster2 ~/mariadb-10.0.21]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DMYSQL_DATADIR=/data/mariadb-galera-10.0.21 \
-DWITH_SSL=system -DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_SPHINX_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all \
-DWITH_EMBEDDED_SERVER=1 -DWITH_READLINE=1 -DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_WSREP=1 -DWITH_INNODB_DISALLOW_WRITES=1
[root@cluster2 ~/mariadb-10.0.21]# make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ..
[root@cluster2 ~]#

5, Cluster3 compile install MariaDB Galera

### Compile and install cmake
[root@cluster3 ~]# tar xf cmake-3.4.0-rc1.tar.gz
[Root @ cluster3 ~] # cd cmake-3.4.0-rc1
[root@cluster3 cmake-3.4.0-rc1]# ./bootstrap
[root@cluster3 cmake-3.4.0-rc1]# make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ../
### Compiler installation kytea
[root@cluster3 ~]# tar xf kytea-0.4.7.tar.gz
[root@cluster3 ~]# cd kytea-0.4.7/
[root@cluster3 ~/kytea-0.4.7]# ./configure && make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ..
### Installation Galera
[root@cluster3 ~]# rpm –import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
[root@cluster3 ~]# rpm -ivh http://mirrors.dwhd.org/SQL/MariaDB/mariadb-galera-10.0.21/galera-25.3.9/rpm/galera-25.3.9-1.rhel6.el6.x86_64.rpm
http://mirrors.dwhd.org/SQL/MariaDB/mariadb-galera-10.0.21/galera-25.3.9/rpm/galera-25.3.9-1.rhel6.el6.x86_64.rpm
### Compile and install MariaDB Galera
[root@cluster3 ~]# mkdir -p /data/mariadb-galera-10.0.21
[root@cluster3 ~]# chown -R mysql.mysql /data/mariadb-galera-10.0.21
[root@cluster3 ~]# tar -xvf mariadb-galera-10.0.21.tar.gz
[root@cluster3 ~]# cd mariadb-10.0.21/
[root@cluster3 ~/mariadb-10.0.21]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DMYSQL_DATADIR=/data/mariadb-galera-10.0.21 \
-DWITH_SSL=system -DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_SPHINX_STORAGE_ENGINE=1 -DWITH_ARIA_STORAGE_ENGINE=1 \
-DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATEDX_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all \
-DWITH_EMBEDDED_SERVER=1 -DWITH_READLINE=1 -DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_WSREP=1 -DWITH_INNODB_DISALLOW_WRITES=1
[root@cluster3 ~/mariadb-10.0.21]# make -j $(awk ‘/processor/{i++}END{print i}’ /proc/cpuinfo) && make install && cd ..
[root@cluster3 ~]#

6, configure all nodes startup scripts, environment variables on

cd /usr/local/mariadb/
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
cp /usr/local/mariadb/support-files/my-large.cnf /etc/my.cnf
sed -i ‘/query_cache_size/a datadir = /data/mariadb-galera-10.0.21’ /etc/my.cnf
echo “export PATH=/usr/local/mariadb/bin:\$PATH” > /etc/profile.d/mariadb_galera.sh
source /etc/profile.d/mariadb_galera.sh
sed -i “$(awk ‘$1==”MANPATH”{i=NR}END{print i}’ /etc/man.config)a \MANPATH\tMANPATH /usr/local/mariadb/man” /etc/man.config

7, Configuration node Cluster1
[root@cluster1 profile.d]# cd /usr/local/mariadb
[root@cluster1 mariadb]# /usr/local/mariadb/scripts/mysql_install_db –user=mysql –datadir=/data/mariadb-galera-10.0.21/
[root@cluster1 mariadb]# cd && service mysqld start
Starting MySQL.. SUCCESS!
[root@cluster1 ~]# ss -tnl | grep :3306
LISTEN     0      128                      :::3306                    :::*
[root@cluster1  ~]# mysql -uroot -p <<< “USE mysql;
update user set password=PASSWORD(‘test123′) WHERE USER=’root’;
DELETE FROM user WHERE User=”;
GRANT ALL PRIVILEGES ON *.* TO ‘cluster’@’%’ IDENTIFIED BY ‘test123’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
SELECT USER,PASSWORD,HOST FROM user;”
Enter password: #### Note that the password is blank, just press Enter enough
USER    PASSWORD        HOST
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       localhost
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       cluster1.rmohan.com
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       127.0.0.1
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       ::1
cluster *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C        %
[root@cluster1 ~]#

[root@cluster1~]# service mysqld stop
Shutting down MySQL… SUCCESS!
[root@cluster1~]# chkconfig mysqld on
[root@cluster1 ~]# sed -i ‘/binlog_format/d’ /etc/my.cnf
[root@cluster1 ~]# sed -i ‘/log_bin/d’ /etc/my.cnf
[root@cluster1 ~]# sed -i ‘/^datadir = /a \\n\nquery_cache_size = 0\nlog_bin = mysql-bin\nbinlog_format = ROW\nexpire_logs_days = 30\
default_storage_engine = InnoDB\ninnodb_autoinc_lock_mode = 2\nwsrep_provider = /usr/lib64/galera/libgalera_smm.so\
wsrep_cluster_address = “gcomm://”\nwsrep_cluster_name = LegionMariadbGaleraCluster1\nwsrep_node_address = node1\
wsrep_sst_method = rsync\nwsrep_sst_auth = cluster:test123’ /etc/my.cnf
[root@cluster1 ~]# service  mysqld start
Starting MySQL.. SUCCESS!
[root@cluster1 ~]# ss -tnl | grep -E ‘:(3306|4567)’
LISTEN     0      128                      :::3306                    :::*
LISTEN     0      128                       *:4567                     *:*

vi /etc/my.cnf

[client]
port            = 3306
socket          = /tmp/mysql.sock
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
datadir = /data/mariadb-galera-10.0.21/
query_cache_size = 0
log_bin = mysql-bin
binlog_format = ROW
expire_logs_days = 30
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2
wsrep_provider = /usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address = “gcomm://cluster1,cluster2,cluster3”
wsrep_cluster_name = LegionMariadbGaleraCluster1
wsrep_node_address = 192.168.1.60
wsrep_sst_method = rsync
wsrep_sst_auth = cluster1:test123
query_cache_size = 0
log_bin = mysql-bin
binlog_format = ROW
expire_logs_days = 30
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2
wsrep_provider = /usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address = “gcomm://cluster1,cluster2,cluster3”
wsrep_cluster_name = LegionMariadbGaleraCluster1
wsrep_node_address=’192.168.1.60′
wsrep_node_name=’cluster1′
wsrep_sst_method=rsync
wsrep_sst_auth= cluster:lookback
thread_concurrency = 8
log-bin=mysql-bin
server-id       = 1
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

### When I tested the rules, see the highlighted lines
[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCEPT
[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p tcp -m state –state NEW -m tcp –dport 4444 -j ACCEPT
[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p tcp -m state –state NEW -m tcp –dport 4567 -j ACCEPT
[root@cluster1 ~]# iptables -t filter -A INPUT -s 192.168.1.60 -p udp -m udp –dport 4567 -j ACCEPT
[root@cluster1 ~]# service iptables save
[root@cluster1 ~]#iptables -t filter -L INPUT -n –line-numbers

8, the configuration node Node2
[root@cluster2 /usr/local/mariadb]# /usr/local/mariadb/scripts/mysql_install_db –user=mysql –datadir=/data/mariadb-galera-10.0.21/
[root@cluster2 /usr/local/mariadb]# cd && service mysqld start
Starting MySQL.. SUCCESS!
[root@cluster2 ~]# mysql -uroot -p <<< “USE mysql;
update user set password=PASSWORD(‘test123′) WHERE USER=’root’;
DELETE FROM user WHERE User=”;
GRANT ALL PRIVILEGES ON *.* TO ‘cluster’@’%’ IDENTIFIED BY ‘test123’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
SELECT USER,PASSWORD,HOST FROM user;”
[root@cluster2 ~]# service mysqld stop
Shutting down MySQL.. SUCCESS!
[root@cluster2 ~]# chkconfig mysqld on
[root@cluster2 ~]# sed -i ‘/binlog_format/d’ /etc/my.cnf
[root@cluster2 ~]# sed -i ‘/log.bin/d’ /etc/my.cnf
[root@cluster2 ~]# sed -ri ‘s/^(server-id).*/\1 = 2/’ /etc/my.cnf
[root@cluster2 ~]# sed -i ‘/^datadir = /a \\n\nquery_cache_size = 0\nlog_bin = mysql-bin\nbinlog_format = ROW\nexpire_logs_days = 30\
default_storage_engine = InnoDB\ninnodb_autoinc_lock_mode = 2\nwsrep_provider = /usr/lib64/galera/libgalera_smm.so\
wsrep_cluster_address = “gcomm://cluster1,cluster2,cluser3″\nwsrep_cluster_name = LegionMariadbGaleraCluster1\n\
wsrep_node_address = node2\nwsrep_sst_method = rsync\nwsrep_sst_auth = cluster:test123’ /etc/my.cnf
[root@cluster2 ~]# service mysqld start
Starting MySQL… SUCCESS!
[root@cluster2 ~]# ss -tnl | grep -E ‘:(3306|4567)’
LISTEN     0      128                      :::3306                    :::*
LISTEN     0      128                       *:4567                     *:*
[root@cluster2 ~]#
[root@cluster2 ~]# grep -v ‘^$\|^\s*\#’ /etc/my.cnf
[client]
port            = 3306
socket          = /tmp/mysql.sock
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
datadir = /data/mariadb-galera-10.0.21
query_cache_size = 0
log_bin = mysql-bin
binlog_format = ROW
expire_logs_days = 30
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2
wsrep_provider = /usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address = “gcomm://cluster1,cluster2,cluster3”
wsrep_cluster_name = LegionMariadbGaleraCluster1
wsrep_node_address = cluster2
wsrep_sst_method = rsync
wsrep_sst_auth = cluster2:test123
thread_concurrency = 8
server-id = 2
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

9, the configuration node Node3

[root@cluster3 /usr/local/mariadb]# /usr/local/mariadb/scripts/mysql_install_db –user=mysql –datadir=/data/mariadb-galera-10.0.21/
[root@cluster3 /usr/local/mariadb]# cd && service mysqld start
Starting MySQL.. SUCCESS!
[root@cluster3 ~]# mysql -uroot -p <<< “USE mysql; > update user set password=PASSWORD(‘test123′) WHERE USER=’root’;
> DELETE FROM user WHERE User=”;
> GRANT ALL PRIVILEGES ON *.* TO ‘cluster’@’%’ IDENTIFIED BY ‘test123’ WITH GRANT OPTION;
> FLUSH PRIVILEGES;
> SELECT USER,PASSWORD,HOST FROM user;”
Enter password:
USER    PASSWORD        HOST
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       localhost
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       cluster3.ovh.net
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       127.0.0.1
root    *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C       ::1
cluster *153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C        %
[root@cluster3 ~]# service mysqld stop
Shutting down MySQL… SUCCESS!
[root@cluster3 ~]# chkconfig mysqld on
[root@cluster3 ~]# sed -i ‘/binlog_format/d’ /etc/my.cnf
[root@cluster3 ~]# sed -i ‘/log.bin/d’ /etc/my.cnf
[root@cluster3 ~]# sed -ri ‘s/^(server-id).*/\1 = 3/’ /etc/my.cnf
[root@cluster3 ~]# sed -i ‘/^datadir = /a \\n\nquery_cache_size = 0\nlog_bin = mysql-bin\nbinlog_format = ROW\nexpire_logs_days = 30\
> default_storage_engine = InnoDB\ninnodb_autoinc_lock_mode = 2\nwsrep_provider = /usr/lib64/galera/libgalera_smm.so\
> wsrep_cluster_address = “gcomm://cluster1,cluster2,cluster3″\nwsrep_cluster_name = LegionMariadbGaleraCluster1\n\
> wsrep_node_address = node3\nwsrep_sst_method = rsync\nwsrep_sst_auth = cluster:test123’ /etc/my.cnf
[root@cluster3 ~]# service mysqld start
Starting MySQL..SST in progress, setting sleep higher.. SUCCESS!

[root@cluster3 ~]# ss -tnl | grep -E ‘:(3306|4567)’
LISTEN     0      128                      :::3306                    :::*
LISTEN     0      128                       *:4567                     *:*
[root@cluster3 ~]#
[root@cluster3 mariadb-galera-10.0.21]# grep -v ‘^$\|^\s*\#’ /etc/my.cnf
[client]
port            = 3306
socket          = /tmp/mysql.sock
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
datadir = /data/mariadb-galera-10.0.21/
query_cache_size = 0
log_bin = mysql-bin
binlog_format = ROW
expire_logs_days = 30
default_storage_engine = InnoDB
innodb_autoinc_lock_mode = 2
wsrep_provider = /usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address = “gcomm://cluster1,cluster2,cluster3”
wsrep_cluster_name = LegionMariadbGaleraCluster1
wsrep_node_address=’192.168.1.63′
wsrep_node_name = ‘cluster3’
wsrep_sst_method = rsync
wsrep_sst_auth = cluster3:test123
thread_concurrency = 8
server-id = 3
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

ISSUES

Disable selinux
Iptables off

1018 16:36:28 [Warning] WSREP: (531d16f9, ‘tcp://0.0.0.0:4567’) address ‘tcp://192.168.1.60:4567’ points to own listening address, blacklisting
151018 16:36:31 [Warning] WSREP: no nodes coming from prim view, prim not possible
151018 16:36:31 [Note] WSREP: view(view_id(NON_PRIM,531d16f9,1) memb {
531d16f9,0
} joined {
} left {
} partitioned {
})
151018 16:36:31 [Warning] WSREP: last inactive check more than PT1.5S ago (PT3.5051S), skipping check
151018 16:37:01 [Note] WSREP: view((empty))
151018 16:37:01 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)
at gcomm/src/pc.cpp:connect():161
151018 16:37:01 [ERROR] WSREP: gcs/src/gcs_core.cpp:long int gcs_core_open(gcs_core_t*, const char*, const char*, bool)():206: Failed to open backend connection: -110 (Connection timed out)
151018 16:37:01 [ERROR] WSREP: gcs/src/gcs.cpp:long int gcs_open(gcs_conn_t*, const char*, const char*, bool)():1379: Failed to open channel ‘LegionMariadbGaleraCluster1’ at ‘gcomm://192.168.1.60,192.168.1.62,192.168.1.63’: -110 (Connection timed out)
151018 16:37:01 [ERROR] WSREP: gcs connect failed: Connection timed out
151018 16:37:01 [ERROR] WSREP: wsrep::connect() failed: 7
151018 16:37:01 [ERROR] Aborting

151018 16:37:01 [Note] WSREP: Service disconnected.
151018 16:37:02 [Note] WSREP: Some threads may fail to exit.
151018 16:37:02 [Note] /usr/local/mariadb/bin/mysqld: Shutdown complete

151018 16:37:02 mysqld_safe mysqld from pid file /data/mariadb-galera-10.0.21//cluster1.rmohan.com.pid ended

[ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)

When node1 starts MySQL, it tries to join an existing cluster. But because both nodes are currently down, there is no primary node available (see this page for a good and short explanation).

So when a Galera Cluster must be started from “zero” again, the first node must be started with the “wsrep-new-cluster” command (exactly during the set up of a new cluster):

service mysql start –wsrep-new-cluster
* Starting MariaDB database server mysqld                               [ OK ]
* Checking for corrupt, not cleanly closed and upgrade needing tables.

10, modify the node configuration Cluster1

[root@cluster1 ~]# sed -ri ‘s/^(wsrep_cluster_address).*/\1 = “gcomm:\/\/cluster1,cluster2,cluster3″/’ /etc/my.cnf
[root@cluster1 ~]# service mysqld restart
Shutting down MySQL…. SUCCESS!
Starting MySQL… SUCCESS!
[root@cluster1 ~]#

11, the test cluster multi-master synchronization
[root@cluster1 ~]# mysql -uroot -ptest123 <<< ‘USE mysql;
CREATE DATABASE LegionTestDataBase;
USE LegionTestDataBase;
CREATE TABLE equipment ( id INT NOT NULL AUTO_INCREMENT, type VARCHAR(50), quant INT, color VARCHAR(25), PRIMARY KEY(id));
INSERT INTO equipment (type, quant, color) VALUES (“slide”, 2, “blue”);
FLUSH PRIVILEGES;
SELECT * FROM LegionTestDataBase.equipment;’
id      type    quant   color
2       slide   2       blue
[root@cluster1 ~]#

INSERT FROM Cluster2

root@cluster2 ~]# mysql -uroot -ptest123 <<< “USE LegionTestDataBase;
SELECT * FROM LegionTestDataBase.equipment;”
id      type    quant   color
2       slide   2       blue
[root@cluster2 ~]# mysql -uroot -ptest123 <<< “USE LegionTestDataBase;
INSERT INTO equipment (type, quant, color) VALUES (‘swing’, 10, ‘yellow’);
SELECT * FROM LegionTestDataBase.equipment;”
id      type    quant   color
2       slide   2       blue
4       swing   10      yellow
[root@cluster2 ~]#

INSERT FROM CLUSTER3

[root@cluster3 ~]# mysql -uroot -ptest123 <<< “USE LegionTestDataBase;
SELECT * FROM LegionTestDataBase.equipment;”
id      type    quant   color
2       slide   2       blue
4       swing   10      yellow
[root@cluster3 ~]# mysql -uroot -ptest123 <<< “USE LegionTestDataBase;
INSERT INTO equipment (type, quant, color) VALUES (‘Legion’, 20, ‘red’);
SELECT * FROM LegionTestDataBase.equipment;”
id      type    quant   color
2       slide   2       blue
4       swing   10      yellow
6       Legion  20      red
[root@cluster3 ~]#

[root@cluster1 ~]# mysql -uroot -ptest123 <<< “USE LegionTestDataBase; SELECT * FROM LegionTestDataBase.equipment;”
id      type    quant   color
2       slide   2       blue
4       swing   10      yellow
6       Legion  20      red
[root@cluster1 ~]#

After the above round of testing, multi-node cluster-wide primary MariaDB is OK. .

Installing Exchange Server 2016

The following section describes a step-by-step guide for the installation of Microsoft® Exchange Server 2016. The installation considers a single server deployment of Exchange Server 2016 with the Mailbox role. Additional details of the topology and architecture of the lab environment which was used in the installation is described here;

 

072415_0820_stepbystepg2

1. Operating System Support for Exchange Server 2016

The following operating systems are supported;

Component Operating System
Mailbox and Edge Server Role Windows Server 2012 R2 Standard or Datacenter
Windows Server 2012 Standard or Datacenter
Windows Server vNext
Management Tools Windows Server 2012 R2 Standard or Datacenter
Windows Server 2012 Standard or Datacenter
64-bit edition of Windows 8.1

 

 

2. Active Directory Preparation

The first task in the installation of any version of Exchange is to prepare the Active Directory environment where the Exchange Server will be placed.

However, prior to the preparation, it should be checked against the following Network and Directory Server requirements;

Component Operating System
Domain controllers Windows Server 2012 R2 Standard or Datacenter
Windows Server 2012 R2 Standard or Datacenter
Windows Server 2008 R2 Standard/Enterprise/Datacenter
Windows Server 2008 Standard/Enterprise/Datacenter
Active Directory forest Windows Server 2008 or higher

Once the above requirements are verified for consistency, proceed with the following preparation tasks on the server/computer which will be used to prepare the Active Directory using the Exchange Server 2016 Active Directory Prepare module.

Download and Install Microsoft .Net Framework 4.5

http://www.microsoft.com/en-us/download/details.aspx?id=42642

072415_0820_stepbystepg3

 

install

  1. Open Windows PowerShell and run the following command to install the Remote Tools Administration Pack.

Install-WindowsFeature RSAT-ADDS

install 001 install 002

 

 

3 Server role prerequisite installation

The prerequisites for Exchange 2016 varies on the server role which will be associated with it. The section describes the installation of Exchange 2016 on a server containing Windows Server 2012 R2 Operating System.

3.1 Prerequisites for Mailbox Server Role

The following section instructs the prerequisite installation that should be performed in a server running a standalone Exchange 2016 server with the Mailbox Server Role.

  1. Open a Windows PowerShell session by navigating to Start > All Programs > Accessories > Windows
    PowerShell.
  2. Run the following command to install the required Windows components.

Install-WindowsFeature AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation

install1 001 install1 002 install1 003

 

 

After installing the features, Download and Install;

 

After installing the features, Download and Install;
  1. Microsoft .Net Framework 4.5https://www.microsoft.com/en-us/download/details.aspx?id=42642&tduid=%24b0e247560194e91bace58dbeb78b2546%24%24256380%24%242459594%24%24TnL5HPStwNw-u2IzFtkCkn6I9speKLeQhw%24%24%24
  2. Microsoft Unified Communications Managed API 4.0, Core Runtime 64-bit

https://www.microsoft.com/en-us/download/details.aspx?id=34992&tduid=%24b0e247560194e91bace58dbeb78b2546%24%24256380%24%242459594%24%24TnL5HPStwNw-lTNTyPCGTqNbP9EliKz3iA%24%24%24

 

3.2 Prerequisites for Edge Server Role

The following section instructs the prerequisite installation that should be performed in a server running a standalone Exchange 2016 server with the Mailbox Server Role.

  1. Open a Windows PowerShell session by navigating to Start > All Programs > Accessories > Windows
    PowerShell.
  2. Run the following command to install the required Windows components.

Install-WindowsFeature ADLDS

3. After installing the features, Download and Install Microsoft .Net Framework 4.5

 

When attempting to install the Microsoft Communications Managed API 4.0 on a Windows Server 2012 machine. You get the following error;

00001

 

Setup has detected that this computer does not meet the requirements to install this software. The following blocking issue must be resolved before you can install Microsoft Unified Communications Managed API 4.0, Runtime software package.

Microsoft Unified Communications Managed API 4.0, Runtime required the following missing Windows Features.
-Media Foundation

Solution

Add Media Foundation via PowerShell

Run the following command;

Install-WindowsFeature Server-Media-Foundation

Add Media Foundation via Server Manager

1. Launch Server Manager (ServerManager.exe) > Manage > Add Roles and Features > Next > Next > Next > Scroll Down > Select Media Foundation > Next > Install

 

00002s

4 Prepare Active Directory and domains

To prepare the active Directory and the Domains for Exchange 2016, follow the following steps. To execute the commands, the commands should be run using the Schema Admins group and the Enterprise Admins group membership.

4.1 Extend Active Directory Schema

  1. Mount the Exchange Server 2016 installation Media
  2. Open up a Command Prompt session and navigate to the setup files from the command prompt
  3. Type the following command followed by an Enter

Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms

 

install1 001 install1 002 install1 003

 

 

3.2 Prerequisites for Edge Server Role

The following section instructs the prerequisite installation that should be performed in a server running a standalone Exchange 2016 server with the Mailbox Server Role.

  1. Open a Windows PowerShell session by navigating to Start > All Programs > Accessories > Windows
    PowerShell.
  2. Run the following command to install the required Windows components.

Install-WindowsFeature ADLDS

3. After installing the features, Download and Install Microsoft .Net Framework 4.5

4 Prepare Active Directory and domains

To prepare the active Directory and the Domains for Exchange 2016, follow the following steps. To execute the commands, the commands should be run using the Schema Admins group and the Enterprise Admins group membership.

4.1 Extend Active Directory Schema

  1. Mount the Exchange Server 2016 installation Media
  2. Open up a Command Prompt session and navigate to the setup files from the command prompt
  3. Type the following command followed by an Enter

Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms

 

exchangeinstall 001

exchangeinstall 002

5 Installing Exchange Server 2016

The below section describes the installation of the Mailbox Server role for Exchange Server 2016.

If you’re installing the first Exchange 2016 server in the organization, and the Active Directory preparation steps have not been performed, the account you use must have membership in the Enterprise Administrators group. If you haven’t previously prepared the Active Directory Schema, the account must also be a member of the Schema Admins group.

  1. Log on to the server that will be used as the Mailbox server.
  2. Ensure that the above prerequisites are completed.
  3. Mount and navigate to the Exchange Server 2016 installation Media.
  4. Start Exchange 2016 Setup by double-clicking Setup.exe.
  5. On the Check for Updates page, select whether you want Setup to connect to the Internet and download product and security updates for Exchange 2016 and click Next.

exchangeinstall 001 exchangeinstall 002 exchangeinstall 003 exchangeinstall 004 exchangeinstall 005 exchangeinstall 006 exchangeinstall 007 exchangeinstall 008 exchangeinstall 009 exchangeinstall 010 exchangeinstall 011 exchangeinstall 012 exchangeinstall 013 exchangeinstall 014 exchangeinstall 015 exchangeinstall 016 exchangeinstall 017

 

 

Review Exchange Installation

Once all the above tasks are performed, proceed with the below steps to verify the installation using the Exchange 2016 Administrative Center and PowerShell. Like its predecessor, Exchange Server 2016 management is handled by the Exchange Admin Center. The browser based management console, EAC can be used to manage your organizations on-premises as well as Office 365 and hybrid deployment scenarios.

To Navigate to the Exchange Admin Center;

  1. Open the web browser.
  2. On the URL section, type the below

    https://<FQDN_of_the_Exchange_Server>/ECP

exchangeinstall 018 exchangeinstall 019

Adding Windows Server 2012 DC in an existing Windows Server 2012

Adding Windows Server 2012 DC in an existing Windows Server 2012

As part of the series of Windows Server 2012 deployment, I will be showing us how to promote a Windows Server 2012 member server into a domain controller in an existing Windows Server 2012 R2 domain. Lets begin the journey 🙂 Exciting.

Requirements:

– Ensure your Forest/Domain functional level is minimum Windows server 2003
– Ensure that you have an existing Windows Server 2012 R2 Domain Controller in place
– Ensure you assign a static IP address to the server. See here for steps
– Ensure you have a domain account that is a member of “Enterprise Admins group“, “Schema Admins group” and/or “Domain Admins group“. This is required for the installer to run the adprep tool

Setup Guide:

– Log into the newly installed Windows Server 2012, click on the server manager icon to launch the server manager screen. Click Manage/Add Roles and Features

Additonal DC 001 Additonal DC 002 Additonal DC 003 Additonal DC 004 Additonal DC 005 Additonal DC 006 Additonal DC 007 Additonal DC 008 Additonal DC 009 Additonal DC 010 Additonal DC 011 Additonal DC 012 Additonal DC 013 Additonal DC 014 Additonal DC 015 Additonal DC 016 Additonal DC 017 Additonal DC 018 Additonal DC 019 Additonal DC 020 Additonal DC 021 Additonal DC 022 Additonal DC 023

Add the users to see the Replication
ad replication 001

ad replication 002

ad replication 003

ad replication 004

Install 2012 r2 domain controller

Install 2012 r2 domain controller

#
# Windows PowerShell script for AD DS Deployment
#

Import-Module ADDSDeployment
Install-ADDSForest `
-CreateDnsDelegation:$false `
-DatabasePath “C:\Windows\NTDS” `
-DomainMode “Win2012R2” `
-DomainName “rmohan.com” `
-DomainNetbiosName “RMOHAN” `
-ForestMode “Win2012R2” `
-InstallDns:$true `
-LogPath “C:\Windows\NTDS” `
-NoRebootOnCompletion:$false `
-SysvolPath “C:\Windows\SYSVOL” `
-Force:$true

2012r2 (2)

2012r2 (3)

2012r2 (4)

2012r2 (5)

2012r2 (6)

2012r2 (7)

2012r2 (8)

2012r2 (9)

2012r2 (10)

2012r2 (11)

2012r2 (12)

2012r2 (13)

2012r2 (14)

2012r2 (15)

2012r2 (16)

2012r2 (17)

2012r2 (18)

2012r2 (19)

2012r2 (20)

2012r2 (21)

2012r2 (22)

2012r2 (23)

2012r2 (24)

2012r2 (25)

2012r2 (26)

2012r2 (27)

2012r2 (28)

2012r2 (29)

2012r2 (30)

2012r2 (31)

2012r2 (32)

2012r2 (33)

2012r2 (34)

2012r2 (35)

2012r2 (36)

2012r2 (37)

2012r2

Install Wget On CentOS 6.7 With A Wget Cheat Sheet

this quick and simple article, we will install wget command on a CentOS 6.7 server and we have included a wget cheat sheet. Wget is a free software package for downloading files using HTTP, HTTPS and FTP.

Prerequisites

A CentOS 6.7 server with Root privileges, if you do no have a server and would like a SSD Cloud server, you can get one here.

Installing wget on a CentOS 6.7

Install wget using the following command:

yum install wget
You will be asked if it is okay to install the downloaded size, you would just type for yes and press Enter to continue. I have screenshot a successful install below

Quick wget Cheat Sheet

To download a single file from a website using the following command:

wget http://sitename.com/file.jpg
If your web page requires a username and password use the following command:

wget –user=youruser –password=yourpassword http://sitename.com/file.jpeg
Download a file from an ftp site using the following command:

wget ftp://sitename.com/file.jpeg
If your ftp site requires a username and password use the following command:

wget —ftp-user=youruser –ftp-password=yourpassword ftp://sitename.com/file.jpeg
Download and entire website using the following command:

wget -r http://sitename.com
Download and save it in a specific path using the following command:

wget –directory-prefix=folder/nextfolder sitename.com
Download a file and save it under a different name using the following command:

wget –output-document=filename.php sitename.com
Resume an interrupted file download using the following command:

wget –continue sitename.com/filename.mp4
Limit download speed of a file using the following command:

wget –limit-rate=1000k http://sitename.com/file.iso
Now you have successfully installed wget and have some examples to work with! You can see the wget manual by running “wget -h”. Please check back here for more updates or check out our related how-to’s below.

Setup Your Own Private Network With OpenVPN

private network connectivity for servers running at the same location. But sometimes you want two servers in different countries / datacenters to be able to communicate in a private and secure way. This tutorial will show you how to achieve that with the help of OpenVPN. The operating systems used here are Debian and CentOS, just to show you two different configurations. This can be easily adapted for Debian -> Debian, Ubuntu -> FreeBSD and so on.

Machine 1: Debian, will act as server (Location: NL)
Machine 2: CentOS, will act as client (Location: FR)
Machine 1
Start on machine 1 by installing OpenVPN:

apt-get install openvpn
Then, copy the example configuration and the tool for generating keys, easy-rsa, to /etc/openvpn:

cp -r /usr/share/doc/openvpn/examples/easy-rsa/ /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn
The default values for your keys aren’t exactly safe anymore, to fix this open /etc/openvpn/easy-rsa/2.0/vars with your favorite text editor and modify the following line:

export KEY_SIZE=4096
Next, ensure that the values are loaded into your current session, clean up eventually existing keys, and generate your certificate authority:

cd /etc/openvpn/easy-rsa/2.0
source ./vars
./clean-all
./build-ca
You will be prompted for information. Make your life easier by supplying information about your server, for example, where it’s located and what the FQDN is/will be. This is useful for when you have to debug problems:

Country Name (2 letter code) [US]:NL
State or Province Name (full name) [CA]:-
Locality Name (eg, city) [SanFrancisco]:Vultr Datacenter NL
Organization Name (eg, company) [Fort-Funston]:-
Organizational Unit Name (eg, section) [changeme]:-
Common Name (eg, your name or your server’s hostname) [changeme]:yourserver1.yourdomain.tld
Name [changeme]:-
Email Address [mail@host.domain]:youraddress@yourdomain.tld
Another necessity is parameters for the Diffie-Hellman key exchange. Those need to be generated too:

./build-dh
Important: The build-dh command is a relatively complex process that can take up to ten minutes, depending on your server’s resources.

To further improve the security of this connection, we will generate a static secret that needs to be distributed amongst all clients:

mkdir /etc/openvpn/keys
openvpn –genkey –secret /etc/openvpn/keys/ta.key
Now, you can generate the key for the server:

./build-key-server server1
This command will prompt for some information:

Country Name (2 letter code) [US]:NL
State or Province Name (full name) [CA]:-
Locality Name (eg, city) [SanFrancisco]:Vultr Datacenter NL
Organization Name (eg, company) [Fort-Funston]:-
Organizational Unit Name (eg, section) [changeme]:-
Common Name (eg, your name or your server’s hostname) [server1]:yourserver1.yourdomain.tld
Name [changeme]:-
Email Address [mail@host.domain]:youraddress@yourdomain.tld
The final step is to sign the certificate request that was just generated with the CA’s key:

1 out of 1 certificate requests certified, commit? [y/n]y
Copy the necessary keys and certificates into a separate folder:

cd /etc/openvpn/easy-rsa/2.0/keys
cp dh4096.pem ca.crt server1.crt server1.key /etc/openvpn/keys/
chmod 700 /etc/openvpn/keys
chmod 600 /etc/openvpn/keys/*
Now for the configuration, unzip it …

cd /etc/openvpn
gunzip server.conf.gz
… and open the resulting server.conf with your favorite text editor. The configuration should look similar to this:

port 1194
proto udp
dev tun

ca keys/ca.crt
cert keys/server1.crt
key keys/server1.key
dh keys/dh4096.pem
server 10.8.100.0 255.255.255.0
ifconfig-pool-persist ipp.txt

# Uncomment this if you have multiple clients
# and want them to be able to see each other
;client-to-client

keepalive 10 120
tls-auth keys/ta.key 0

tls-cipher DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-CAMELLIA256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA128-SHA:DHE-RSA-AES128-SHA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
cipher AES-256-CBC
auth SHA384
comp-lzo

user nobody
group nogroup

persist-key
persist-tun
verb 3
mute 20
After restarting the service you should watch your log a bit …

service openvpn restart && tail -f /var/log/syslog
… to make sure everything is working. If no errors are detected, then you can generate the keys for your second server:

cd /etc/openvpn/easy-rsa/2.0
source ./vars
./build-key server2
Again, you will be prompted for information:

Country Name (2 letter code) [US]:FR
State or Province Name (full name) [CA]:-
Locality Name (eg, city) [SanFrancisco]:Vultr Datacenter FR
Organization Name (eg, company) [Fort-Funston]:-
Organizational Unit Name (eg, section) [changeme]:-
Common Name (eg, your name or your server’s hostname)
[server2]:yourserver2.yourdomain.tld
Name [changeme]:-
Email Address [mail@host.domain]:youraddress@yourdomain.tld
Now, you need to transfer the necessary files to your second server, preferably encrypted:

cd /etc/openvpn/easy-rsa/2.0/keys
cp /etc/openvpn/keys/ta.key .
tar -cf vpn.tar ca.crt server2.crt server2.key ta.key
scp vpn.tar yourusername@server2:~/
rm vpn.tar
Machine 2
Time to switch to the SSH-connection of your second server. The first step is to install OpenVPN …

yum install openvpn
… and to deactivate firewalld. The replacement will be plain iptables.

systemctl stop firewalld
systemctl disable firewalld
Unpack the archive that you just moved to the server and properly set permissions on the files:

cd /etc/openvpn
mkdir keys
chmod 700 keys
cd keys
tar -xf ~/vpn.tar -C .
chmod 600 *
Create /etc/openvpn/client.conf with your favorite text editor. It should look like this:

client
dev tun
proto udp

remote yourserver yourport
resolv-retry infinite
nobind
user nobody
group openvpn

persist-key
persist-tun

ca keys/ca.crt
cert keys/server2.crt
key keys/.key

ns-cert-type server
tls-auth keys/ta.key 1

tls-cipher DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-CAMELLIA256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA128-SHA:DHE-RSA-AES128-SHA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
cipher AES-256-CBC
auth SHA384

remote-cert-tls server

comp-lzo
verb 3
mute 20
The last step is to start and enable the service:

systemctl start openvpn@client.service
systemctl enable openvpn@client.service
If everything is working, then you should have no problem pinging the first server:

PING 10.8.100.1 (10.8.100.1) 56(84) bytes of data.
64 bytes from 10.8.100.1: icmp_seq=1 ttl=64 time=17.8 ms
64 bytes from 10.8.100.1: icmp_seq=2 ttl=64 time=17.9 ms
64 bytes from 10.8.100.1: icmp_seq=3 ttl=64 time=17.8 ms
You now have a private connection over the Internet!

If you need to troubleshoot any errors, try checking the logs with the following command:

journalctl -xn

How to merge contents of 2 files using paste?

This is one of the best command that facilitates the system admin to perform his specific tasks. Below is the list with the examples showing the paste command.

[localhost@localhost ~]$ cat file1
apple
orange
mango
banana

[localhost@localhost ~]$ cat file2
coldplay
westlife
michael
sunibigyana
piyush

[localhost@localhost ~]$ paste -s file1
apple orange mango banana

[localhost@localhost ~]$ paste -d, -s file1
apple,orange,mango,banana

[localhost@localhost ~]$ paste – – < file1 apple orange mango banana [localhost@localhost ~]$ paste -d':' - - < file1 apple:orange mango:banana [localhost@localhost ~]$ paste - - - < file1 apple orange mango banana [localhost@localhost ~]$ paste -d ':,' - - - < file1 apple:orange,mango banana:, [localhost@localhost ~]$ cat file2 coldplay westlife michael sunibigyana piyush [localhost@localhost ~]$ paste file1 file2 apple coldplay orange westlife mango michael banana sunibigyana piyush [localhost@localhost ~]$ paste -d, file1 file2 apple,coldplay orange,westlife mango,michael banana,sunibigyana ,piyush [localhost@localhost ~]$ cat file2 | paste -d, file1 - apple,coldplay orange,westlife mango,michael banana,sunibigyana ,piyush [localhost@localhost ~]$ cat file1 | paste -d, - file2 apple,coldplay orange,westlife mango,michael banana,sunibigyana ,piyush [localhost@localhost ~]$ cat file1 file2 | paste -d, - - apple,orange mango,banana coldplay,westlife michael,sunibigyana piyush, [localhost@localhost ~]$ paste -d'\n' file1 file2 apple coldplay orange westlife mango michael banana sunibigyana piyush [localhost@localhost ~]$