Amazon

Friday, 6 November 2015

Postgres Plus Hot-standby Streaming replication


Image result for postgresql plus advanced server
PPAS
Postgres Plus Advanced Server (PPAS) 9.2

Installation, initial configuration,  Hot-standby Streaming replication




Step 1:-- unzip the installation archive file.
Step 2:-- Make the installer directory your current directory
Note 1:-- while installation when asked for either an oracle or postgresql installation select oracle will give you all of the oracle performance and scability features not found in community postgreSQL.
Note 2:-- Enter the password for the database super user. Be sure remember this you will need the password   later.
Install the PPAS on both the primary and secondary server.
On primary server
Installation  directory :/opt/PostgresPlus/9.2AS
Data Directory : /opt/PostgrePlus/9.2AS/data
WAL Directory : /opt/PostgresPlus/9.2AS/data/pg_xlog
Database  port :5444
Database  Superuser : enterprisedb
Operating System Account: enterprisedb
Database  Service :ppas-9.2
Pg_bouncer: 6432
On secondary server
Installation directory: /opt/PostgresPlus/9.2AS
Data Directory: /opt/PostgrePlus/9.2AS/data
WAL Directory: /opt/PostgresPlus/9.2AS/data/pg_xlog
Database  port :5445
Database  Superuser : enterprisedb
Operating System Account: eEnterprise
Database  Service :ppas-9.2
Pg_bouncer: 6432
Step 3 :--Make changes in the primary server
open the Postgresql.conf configuration file and modify it
#vim  /opt/PostgrePlus/9.2AS/data/postgresql.conf
 listen_addresses = '*'
wal_level = hot_standby
max_wal_senders = 1
wal_keep_segments = 5
rchive_mode = on
archive_command = 'cp %p "/opt/archive/%f"'
step 4: Create an archive directory under the opt
step 5:--change the pg_hba.conf file
#vim pg_hba.conf
host     replication     repuser             Secondary-Server-IP/32        trust
step 6:-- make changes in the stand by server
change in the postgresql.conf  file
#vim  /opt/PostgrePlus/9.2AS/data/postgresql.conf
hot_standby = on
step 7:--copy recovery.conf.sample  as recovery.conf
#cp  /opt/PostgresPlus/9.2AS/share/recovery.conf.sample  /opt/PostgresPlus/9.2AS/data/recovery.conf
#vim /opt/PostgresPlus/9.2AS/data/recovery.conf
standby_mode = on
primary_conninfo = 'host=Primary-Server-IP  port=5444 user=repuser password=admin'
restore_command = 'cp /opt/archive/%f %p'

step 8:-- Create an archive directory in the opt.

step 9:-- Create a replication user as repuser and password
connecting  to the database

#cd  /opt/PostgresPlus/9.2AS/bin
#./psql  -U (username)  -d  (database name)
edb=#create user repuser with replication password  ’**password**’;
(creating a user in the database)
edb=#select  pg_start_backup(‘base backup’)
Meanwhile we need copy all the content of dats directory from primary to secondary .
#cd  /opt/PostgresPlus/9.2AS/data
#rsync –av  --exclude pg_xlog  --exclude  postgresql.conf  --exclude postmaster.pid    .   Primary-Server-IP:/opt/PostgresPlus/9.2AS/data
Edb=#select  pg_stop_backup();

Step 10:--  connect to the database and run the following command to see the current wal  location(on the primary server)
edb=#SELECT  pg_current_xlog_location();(to see the current wal location)
edb=#select * from pg_stat_replication;(to check the status of replication)
step 11:-- connect to the database and u can run (on the standby server)
edb=#SELECT  pg_last_xlog_receive_location();
edb=#SELECT pg_last_xlog_replay_location();


RDBMS and NoSQL

In the market various type of Database options are available like RDBMS, NoSQL, Big Data, Database Appliance, etc. developers can get very confused with all the choice. They do not understand why they should consider a newer, alternative database when RDBMSs have been around for 25+ years. However, many big enterprises are already using alternative databases and are saving money, innovating more quickly, and completing projects.

Relational Database Management System (RDBMS)
RDBMS  is a relational database. It is the standard language for relational database management systems.Data is stored in the form of rows and columns in RDBMS. The relations among tables are also stored in the form of the table.  SQL (Structured query Language) is a programming language used to perform tasks such as update data on a database, or to retrieve data from a database. Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, etc.
Features Of RDBMS
  1. SQL databases are table based databases
  2. Data store in rows and columns
  3. Each row contains a unique instance of data for the categories defined by the columns.
  4. Provide facility primary key, to uniquely identify the rows
Limitations for SQL database
Scalability: Users have to scale relational database on powerful servers that are expensive and difficult to handle. To scale relational database it has to be distributed on to multiple servers. Handling tables across different servers is difficult .
Complexity: In SQL server’s data has to fit into tables anyhow. If your data doesn’t fit into tables, then you need to design your database structure that will be complex and again difficult to handle.
NoSQL
 NoSQL commonly referred to as “Not Only SQL”.  With NoSQL, unstructured, schema less data can be stored in multiple collections and nodes and it does not require fixed table sachems, it supports limited join queries, and we scale it horizontally.
Benefits of NoSQL
highly and easily scalable
Relational database or RDBMS databases are vertically Scalable When load increase on RDBMS database then we scale database by increasing server hardware power ,need to by expensive and bigger servers and NoSQL databases are designed to expand horizontally and in Horizontal scaling means that you scale by adding more machines into your pool of resources.
Maintaining NoSQL Servers is Less Expensive
Maintaining high-end RDBMS systems is expensive and need trained manpower for database management but NoSQL databases require less management. it support many Features like automatic repair, easier data distribution, and simpler data models make administration and tuning requirements lesser in NoSQL.
Lesser Server Cost and open-Source
NoSQL databases are cheap and open source. NoSql database implementation is easy and typically uses cheap servers to manage the exploding data and transaction while RDBMS databases are expensive and it uses big servers and storage systems. So the storing and processing data cost per gigabyte in the case of NoSQL can be many times lesser than the cost of RDBMS.
No Schema or Fixed Data model
NoSQL database is schema less so Data can be inserted in a NoSQL database without any predefined schema. So the format or data model can be changed any time, without application disruption.and change management is a big headache in SQL.
Support Integrated Caching
NoSQL database support caching in system memory so it increase data output performance and SQL database where this has to be done using separate infrastructure.
Limitations & disadvantage of NoSQL
  1. NoSQL database is Open Source and Open Source at its greatest strength but at the same time its greatest weakness because there are not many defined standards for NoSQL databases, so no two NoSQL databases are equal
  2. No Stored Procedures in mongodb (NoSql database).
  3. GUI mode tools to access the database is not flexibly available in market
  4. too difficult for finding nosql experts because it is latest technology and NoSQL developer are in learning mode
Conclusion
RDBMS and NoSQL both databases are great in data management and both are used to keep data storage and retrieval optimized and smooth. It’s hard to say which technology is better so developer take decision according requirement and situations.
source: http://www.loginradius.com/

Wednesday, 12 June 2013

Secure Email (Outlook Express) with Digital Certificate

Part I: Export of Digital Certificate and Private Key


Login as administrator onto Certificate Server (Windows server 2003 with IP xxx.xxx.xxx.xxx) 

 Step-I.  Active Directory User Creation


            Start à Programs à Administrative Tools à Active directory users & computers à right click testcert.digitalcert.com à new à user à create user by giving required details.

Right click on newly created user à properties à Enter e-mail id for the user under       E-mail field à apply à OK

 Step-II. Digital Certificate Creation


            Open Internet Explorer with URL             http://xxx.xxx.xxx.xxx/certsrv  login with newly created username and password.

            Request a certificate à Advanced certificate request à Create and submit a request to this CA à Change following settings in the Advanced certificate request window, change to user in certificate template, enter friendly name as user name, click submit à yes (do you want to request a certificate now) à Install this certificate à yes (Do you want to add this certificate now) à close Internet Explorer after Certificate Installed message displays.

Step-III. Digital Certificate Export


Start à Programs à Administrative Tools à Certification Authority à testcertrootca (Under Certification Authority Console) à Issued certificates à Newly created certificate for the user will be shown in bottom, double click it à Details tab à copy to file à (Export wizard window will be displayed) next à Select Cryptographic message syntax standard PKCS#7 certificate and tick Include all certificates in the certification path if possible, click next à Enter file name, select file type as PKCS#7 (*.p7b) à Finish à OK à OK (Closes certificate window) à close Certification Authority console.

 Step-IV. Private Key Export

             Start à Run à In open box type certmgr.msc, click OK à  (Certificate manager console will be displayed) Personal à certificates à right click on newly created user certificate à all tasks à export à (Certificate Export wizard will be displayed) next à yes export the private key à next à enter password (give user name) à Enter file name, select file type as *.pfx à next à Finish à OK à Close certificate manager console 


Part-II.  Steps for Import and Configure of Digital Certificate into Outlook Express of a PC

  
Copy Digital certificates and Private Key from Certificate server to PC

Step-I. Import Private Key to Certificate Store


Open Internet Explorer à tools à internet options à content à certificate à advanced à tick all in certificate purpose à OK à Import à (Certificate Import wizard window will be displayed) next à Enter file name, *.pfx à enter password (give user name), click next à next à finish à OK (Import Successful) à close à OK (Closes Internet Options) à Close Internet Explorer.

Step-II. Import Digital Certificate to Certificate Store


Open Internet Explorer à tools à internet options à content à certificate à Import à (Certificate Import wizard window will be displayed) next à Enter file name, *.p7b à next à finish à yes (Do you want to add the following certificate to the root store) à OK (Import Successful) à close à OK (Closes Internet Options) à Close Internet Explorer.

Step-III. Configuring Digital Certificate into Outlook Express

            Open Outlook Express à tools à accounts à mail à select default mail à properties à security à under Signing Certificate, click select à Select newly issued certificate, click OK à under Encryption Preferences, click select à Select newly issued certificate, click OK à apply à OK à close (account properties window).

Step-IV. Adding Other email user Digital Certificate to Address Book



Open Outlook Express à tools à address book à check for entry of other user e-mail id, if not found, create a new contact by giving name and e-mail address à select and right click on user e-mail id à properties à digital id’s à import à enter file name, file type *.p7b à OK à close address book.


Tuesday, 11 June 2013

Installation of Oracle 10g On RHEL5

Installation of Oracle 10g On RHEL5

Step 1:-- Disable the selinux.
Step 2:-- Turn of the iptables.
STEP 3:-- Create a hostname and domain name in the /etc/hosts file
Step 4:-- Set the kernel parameters

#vim  /etc/sysctl.conf
Kernel.shmall  =  2097152
kernel.shmmax  =  2147483648
kernel.shmmni  =  4096
kernel.sem   =  250  32000 100  128
Fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default  = 262144
net.core.rmem_max  =  262144
net.core.wmem_default   =  262144
net.core.wmem_max   =  262144

step 5 :-- Run the following command to change the current kernel parameters
#/sbin/sysctl  -p

Step 6 :-- Add  the following line into the /etc/pam.d/login

#vim  /etc/pam.d/login
session        required             pam_limits.so

step 7:-- Install  the  binary packages required. 

binutils-2.17.50.0.6-14.el5.x86_64.rpm
Compat-db-4.2.52-5.1.i386.rpm
Compat-db-4.2.52-5.1.x86_64.rpm
Compat-gcc-34-3.4.6-4.x86_64.rpm
Compat-gcc-34-c++-3.4.6-4.x86_64.rpm
Compat-libstdc++-33-3.2.3-61.i386.rpm
Compat-libstdc++-33-3.2.3-61.x86_64.rpm
Cpp-4.1.2-48.el5.x86_64.rpm
Elfutils-libelf-0.137-3.el5.i386.rpm
Elfutils-libelf-0.137-3.el5.x86_64.rpm
Gcc-4.1.2-48.el5.x86_64.rpm
gcc-c++-4.1.2-48.el5.x86_64.rpm
glibc-2.5-49.i686.rpm
glibc-2.5-49.x86_64.rpm
glibc-devel-2.5-49.i386.rpm
glibc-devel-2.5-49.x86_64.rpm
glibc-headers-2.5-49.x86_64.rpm
kernel-headers-2.6.18-194.el5.x86_64.rpm
ksh-20100202-1.el5.x86_64.rpm
libaio-0.3.106-5.i386.rpm
libaio-0.3.106-5.x86_64.rpm
libaio-devel-0.3.106-5.i386.rpm
libaio-devel-0.3.106-5.x86_64.rpm
libgomp-4.4.0-6.el5.x86_64.rpm
libstdc++-4.1.2-48.el5.i386.rpm
listed++-4.1.2-48.el5.x86_64.rpm
libstdc++-devel-4.1.2-48.el5.x86_64.rpm
libXmu-1.0.2-5.i386.rpm
libXp-1.0.0-8.1.el5.i386.rpm
libXp-1.0.0-8.1.el5.x86_64.rpm
make-3.81-3.el5.x86_64.rpm
openmotif-2.3.1-2.el5_4.1.i386.rpm
openmotif-2.3.1-2.el5_4.1.x86_64.rpm
setarch-2.0-1.1.x86_64.rpm

step8 :-- create a users and groups

#groupadd  oinstall
#groupadd dba
#useradd  -g dba  -G  oinstall  oracle

Step9 :-- create a directories in which oracle software installed.

#mkdir  -p  /oracle/product/10.2.0/db_1

Step10 :-- change the owner and primary group of a oracle installation  directory.

#chown –R    oracle:dba /oracle

Step 11:-- Run the command following command hostname being added to access control list

#xhost  ora10g.xyz.com

Step 12:-- Login as the oracle user and add the following lines at the end of the .bash_profile

#vim  .bash_profile

TMP=/tmp;  export TMP
TMPDIR=$TMP;  export  TMPDIR
ORACLE_BASE=/ora10g/oracle; export  ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export  ORACLE_HOME
ORACLE_SID=orcl; export  ORACLE_SID
ORACLE_TERM=xterm; export  ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;  export  LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

NOTE :please enter carefully above directory path, while installation we have to mention the same path.

Step 13:-- Save the .bash_profile and execute the following command to load new environment.

#.   .bash_profile

Step14  :login as the oracle user. If you are using X emulation then display the variable.
DISPLAY=ora10g.xyz.com:0.0;  export DISPLAY

Step 15:-- uncheck the file into temporary directory.

#gunzip  10201_database_linux_x86_64.cpio.gz
#cpio   -idmv  <  10201_database_linux_x86_64.cpio

Step 16:--  Change  the redhat release version from 5 to 4

#vim  /etc/redhat-release
 Red Hat Enterprise Linux Server release 4.0

Step 17 :-- start the oracle universal installer by issuing the following command in the  database directory

./runinstaller
Select the following options while installing
Installation type : standard edition
Unix dba group oinstall
Global database name orcl
Database password : ********

POST-INSTALLATION TASK

Step 1:--#vim  /etc/oratab
Login as root and modify /etc/oratab file and change file and change the last character to Y for appropriate database.

Step 2:-- As root user create a new file “oracle” (init script start and shutdown the database) in /etc/init.d/directory with following content

#vim  /etc/init.d/oracle
#!/bin/bash
#
#oracle Init file for starting and stopping
#oracle Database. Script is valid for 10g and 11g versions.
#
#chkconfig: 35 80 30
# description: Oracle Database startup script
#Source function library.
./etc/rc.d/init.d/functions
ORACLE_OWNER="oracle"
ORACLE_HOME="/ora10g/oracle/product/10.2.0/db_1"
case "$1" in
Start)
echo -n $"Starting Oracle DB:"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
echo "ok"
;;      
stop)  
echo -n $"Stopping Oracle DB"
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
echo "ok"
;;
*)
echo $"Usage: $0 {start|stop}"
esac
step 3:-- add the oracle to the run levels
#chkconfig   --add oracle
Step 4:-- permanently on the oracle to the run levels
#chkconfig –oracle on