Posts

Showing posts from 2015

Mysql Basic Commands

How to install MySQL in RHEL and Centos # yum install mysql* -y ----------------------------------------------------- How to start MySQL # service mysqld start # /etc/init.d/mysqld start ---------------------------------------------------- How to set root password in MySQL # mysqladmin password "redhat" ---------------------------------------------------- How to Login in Mysql # mysql -u root -predhat mysql> ---------------------------------------------------- How to change root and Users password mysql> UPDATE mysql.user SET Password=PASSWORD('redhat123') WHERE User='root'; ----------------------------------------------------------------------------------------- How to Create database mysql> create database DB-NAME; How to Check database mysql> show databases; How to Create User mysql> CREATE USER 'USER_NAME'@'localhost' IDENTIFIED BY 'PASSWORD'; How to given PRIVILEGES mysql> GRANT ALL PRIVILEGES ON `DB-NAME` . * TO

Nagios Doc

                                             NAGIOS DOC  I have using RHEL and CentOS 6.4 64 Bit Machines   Step 1: Install Required Packages and Dependencies We assume that you have fresh installed CentOS, Red hat or Fedora systems, So our first requirement is to install Apache and PHP first. Use the following commands to complete it. You can find detailed LAMP setup instruction here. Install Packages: # yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp xinetd openssl* -y Start Services: # service httpd start Step 2: Setup User Accounts Now create a new nagios user account and setup a password to this account # useradd nagios # passwd nagios Step 3: Install Nagios Core Service After installing required dependencies and adding user accounts. Lets start with Nagios core installation. Download latest nagios core service from official site. # cd /opt/ # wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz # tar xzf nagios-4.0.8.tar

Corosync Pacemaker Haproxy Cluster

        Corosync Pacemaker Haproxy Cluster Document. I have using RHEL6.4 64 Bit Machines IP 192.168.0.100  Name Node1.example.com IP 192.168.0.101  Name Node2.example.com IP 192.168.0.200 (Virtual IP) 1. installing require Packages both Node ( Node1 & Node2 ) # yum install haproxy corosync pacemaker openssh-clients http* -y # wget -c http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/x86_64/crmsh-2.1-1.6.x86_64.rpm # wget -c http://pkgs.repoforge.org/pssh/pssh-2.0-1.el6.rf.noarch.rpm # rpm -ivh pssh-2.0-1.el6.rf.noarch.rpm # yum  install crmsh-2.1-1.6.x86_64.rpm 2. Configure host file both Node ( Node1 & Node2 ) # vim /etc/hosts ( NODE1 Machine) 192.168.0.100  Node1.example.com  Node1 192.168.0.101  Node2.example.com  Node2 # vim /etc/hosts  ( NODE2 Machine ) 192.168.0.100  Node1.example.com  Node1 192.168.0.101  Node2.example.com  Node2 3. Configure httpd for testing  both Node ( Node1 & Node2 ) # vim /etc/httpd/conf/httpd.conf (

Multiple Mysql Instances On Same Machine

                Multiple Mysql Instances On Same Machine I am using RHEL5.8 64 Bit Machine and Using mysql (mysql-5.0.77-4.el5_6.6) We Need 2 Instances in Same Machine. [root@localhost ~]# yum install mysql* -y [root@localhost ~]# rpm -qa | grep -i mysql php-mysql-5.1.6-32.el5 perl-DBD-MySQL-3.0007-2.el5 mysql-5.0.77-4.el5_6.6 mysql-server-5.0.77-4.el5_6.6 [root@localhost ~]# /etc/init.d/mysqld restart [root@localhost ~]# mysqladmin password "Password" [root@localhost ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.0.77 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> exit [root@localhost ~]# netstat  -tulnp | grep mysql tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      8284/mysqld [root@localhost ~]# cp /etc/init.d/mysqld /etc/init.d/mysqld3307 [root@localhost ~]# ll /etc/init

HAproxy Document

                                         HAproxy Document.     I have use 2 machine and running OS is RHEL6.4 or CentOS 6.4.64Bit Machine Details IP 192.168.0.100 Hostname node1.example.com IP 192.168.0.101 Hostname node2.example.com Virtual IP 192.168.0.200 # yun install haproxy httpd* -y (in both Machine node1 and node2) Configure httpd NODE1 # vim /etc/httpd/conf/httpd.conf Listen 192.168.0.100:8080 ServerName example.com # vim /var/www/html/index.html haproxy node1 # /etc/init.d/httpd  restart # chkconfig httpd on NODE2 # vim /etc/httpd/conf/httpd.conf Listen 192.168.0.101:8080 ServerName example.com # vim /var/www/html/index.html haproxy node2 # /etc/init.d/httpd  restart # chkconfig httpd on # cp  /etc/haproxy/haproxy.cfg  /etc/haproxy/haproxy.cfg-ORG ( copy haproxy.conf file backup in both machine node1 and node2 ) configure haproxy node1 Server # vim /etc/haproxy/haproxy.cfg global  log         192.168.0.200 local2 debug     chroot    

OpenLDAP With Sudo

                              OpenLDAP With Sudo User Document.                          I have Useing RHEL6.4 or Centos 6.4 64Bit OpenLDAP Server Installation Stap 1. install Below Packages in you Local Yum. # yum install openldap* migrationtools nss-pam-ldapd pam_ldap.x86_64 2. Copy DB_CONFIG file in ldap DB Folder. # cp /usr/share/openldap-servers/DB_CONFIG.example  /var/lib/ldap/DB_CONFIG 3. Copy slapd.conf configuretion file openldap folder. # cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf # cp /usr/share/doc/sudo-1.8.6p3/schema.OpenLDAP  /etc/openldap/schema/sudo.schema 4. Create Ldap root User Password in incrypt form. # slappasswd passowd XXXX retry password XXXX {SSHA}ys0KIpUDTxDV8kys2q98/iLb/44YZDpd 5. configure slapd.conf # vim /etc/openldap/slapd.conf change below Lines. # See slapd.conf(5) for details on configuration options. # This file should NOT be world readable. # include         /etc/openldap/schema/corba.schema database config access

Mysql Master Slave Replication

                      MySQL Master Slave Replication MASTER   SIDE ============================== ========================= == # vim /etc/my.cnf   (add below ) ============================== ========================= == server-id = 1 log_bin = /var/lib/ mysql / mysql -bin.log binlog_do_db = DB_NAME (if you need all databases then no need this parameter) ============================== ============================== ======================= # service mysqld restart ============================== ============================== ======================= LOGIN IN MASTER DATABASE ============================== ============================== ======================= # mysql -u root -pXXXXXXX mysql > create database DB_NAME; mysql > use mysql ; mysql > GRANT REPLICATION SLAVE ON *.* TO 'UserName'@'%' IDENTIFIED BY 'Password'; mysql > FLUSH PRIVILEGES; ============================== ===============