Showing posts with label active. Show all posts
Showing posts with label active. Show all posts
Friday, April 28, 2017
DB2 Q Replication setup for an active active solution PART 2
DB2 Q Replication setup for an active active solution PART 2
Im back after my 5 day continuous night shifts.. Its Saturday today fresh day to start with PART 2 to quick setup of DB2 Q Replication for active active solution
Installation of Websphere MQ 7.1 :
1) Untar the installation files
tar -xvf WMQ_7.1.0.3_TRIAL_LNX_X86_64_ML.tar.gz
2) we need to accept the license before proceeding for installation of MQ
sudo ./mqlicense.sh -accept
3) Now lets install Websphere MQ using below command
rpm -ivh MQSeries*
4) After MQ installed we need to set the current installation as primary for that we need to run setmqinst command from installation path like below.
sudo ./mqsetinst -i -p /opt/mqm
After it executes we should see this messages like below.
[db2inst1@fedorabox bin]$ sudo ./setmqinst -i -p /opt/mqm/
114 of 114 tasks have been completed successfuly.
Installation1 (/opt/mqm) set as the Primary Installation.
[db2inst1@fedorabox bin]$ dspmqver
Name: WebSphere MQ
Version: 7.1.0.3
Level: p710-003-130724
BuildType: IKAP - (Production)
Platform: WebSphere MQ for Linux (x86-64 platform)
Mode: 64-bit
O/S: Linux 3.6.10-4.fc18.x86_64
InstName: Installation1
InstDesc:
InstPath: /opt/mqm
DataPath: /var/mqm
Primary: Yes
MaxCmdLevel: 711
If this MQ installation is not first time on your machine, you need to run crtmqpkg command to create unique set of packages to install in your system. In order to do this we need to install pax before running crtmqpkg command
sudo apt-get install pax
sudo ./crtmqpkg PROD
after the packages are created a path is displayed where those are created we need to go to that directory and install the available RPMs for MQ .
cd /var/tmp/mq_rpms/PROD/
sudo crtmqpkg test
sudo rpm -ivh MQSeries*
================= End of installation Websphere MQ ===========================
A prerequisite for using Q Replication is that databases should be enabled for archive logging. use below script that creates a database , setup archive logging, and take an offline backup . see that you create the needed directories that used for archive log location, Put it everything in a file and run it.
create database testa;
create database testb;
update db cfg for testa using LOGARCHMETH1 DISK:/home/db2inst1/archivelogs/testa;
backup database testa to /dev/null;
update db cfg for testb using LOGARCHMETH2 DISK:/home/db2inst1/archivelogs/testb;
backup database testb to /dev/null;
db2 -stvf create.sql -z create.out
Now lets create Queue Manager and it objects. Use below script
ASNCLP SESSION SET TO Q REPLICATION;
CREATE MQ SCRIPT CONFIG TYPE B
MQSERVER 1 NAME TESTA MQHOST "fedorabox" MQPORT 2416 QMANAGER QMTA QNAME_QUAL ASNTA,
MQSERVER 2 NAME TESTB MQHOST "fedorabox" MQPORT 2417 QMANAGER QMTB QNAME_QUAL ASNTB;
Change the "fedorabox" hostname to your machine name.
Important points to understand here:
CREATE MQ SCRIPT command will generate scripts for creating all of the WebSphere MQ objects that are needed for Q Replication. Lets run the script using asnclp command line, Once done we can see 4 files created 2 files ending with .sh is for unix/linux OS , 2 files ending with .bat is for windows OS.
[db2inst1@fedorabox scripts]$ asnclp -f create_mq_objects.asn
[db2inst1@fedorabox scripts]$ ls -lrt
total 40-rw-rw-r--. 1 db2inst1 db2inst1 240 Apr 12 19:49 create_mq_objects.asn
-rw-rw-r--. 1 db2inst1 db2inst1 5329 Apr 12 19:50 qrepl.testa.mq_windows.bat
-rw-rw-r--. 1 db2inst1 db2inst1 5330 Apr 12 19:50 qrepl.testa.mq_aixlinux.sh
-rw-rw-r--. 1 db2inst1 db2inst1 4671 Apr 12 19:50 qrepl.testb.mq_windows.bat
-rw-rw-r--. 1 db2inst1 db2inst1 4666 Apr 12 19:50 qrepl.testb.mq_aixlinux.sh
-rw-rw-r--. 1 db2inst1 db2inst1 412 Apr 12 19:50 qreplmsg.log
Now switch to mq user and run the 2 files one for testa other for testb.
sh qrepl.testa.mq_aixlinux.sh
sh qrepl.testb.mq_aixlinux.sh
After running that we should be able to see there are 2 Queue managers that should up and running as show below.
[db2inst1@fedorabox mqm]$ dspmq
QMNAME(QMTA) STATUS(Running)
QMNAME(QMTB) STATUS(Running)
[db2inst1@fedorabox mqm]$ dspmq
QMNAME(QMTA) STATUS(Running)
QMNAME(QMTB) STATUS(Running)
[db2inst1@fedorabox scripts]$ db2 connect to testa
Database Connection Information
Database server = DB2/LINUXX8664 9.7.6
SQL authorization ID = DB2INST1
Local database alias = TESTA
[db2inst1@fedorabox scripts]$ db2 "create table dba(id num not null,name varchar(10), topic varchar(10))"
DB20000I The SQL command completed successfully.
[db2inst1@fedorabox scripts]$ db2 "alter table dba add primary key(id)"
DB20000I The SQL command completed successfully.
[db2inst1@fedorabox scripts]$ db2 connect to testb
Database Connection Information
Database server = DB2/LINUXX8664 9.7.6
SQL authorization ID = DB2INST1
Local database alias = TESTB
[db2inst1@fedorabox scripts]$ db2 "create table dba(id num not null,name varchar(10), topic varchar(10))"
DB20000I The SQL command completed successfully.
[db2inst1@fedorabox scripts]$ db2 "alter table dba add primary key(id)"
DB20000I The SQL command completed successfully.
Now we use below script to create control tables,replication queue maps and a sample subscription for table DBA.
Important points to understand here:
create control tables statement will create control tables which store information about Q replication and its sources and targets.
create replqmap statement will create replication queue maps which are needed to identify websphere mq queues on both the servers that is source and target. One replication queue map defined from source to target and one for target to source.
create qsub statement will create a queue subscription that maps source table to target table.
ASNCLP SESSION SET TO Q REPLICATION;
SET OUTPUT MULTIDIR;
SET RUN SCRIPT NOW STOP ON SQL ERROR ON;
SET BIDI NODE 1 SERVER DBALIAS TESTA ID "DB2INST1" PASSWORD "db2inst1" SCHEMA ASNTA;
SET BIDI NODE 2 SERVER DBALIAS TESTB ID "DB2INST1" PASSWORD "db2inst1" SCHEMA ASNTB;
SET QMANAGER QMTA FOR NODE 1;
SET QMANAGER QMTB FOR NODE 2;
CREATE CONTROL TABLES FOR NODE 1;
CREATE CONTROL TABLES FOR NODE 2;
CREATE REPLQMAP "TESTA.ASNTA_TO_TESTB.ASNTB" (NODE 1, NODE 2);
CREATE REPLQMAP "TESTB.ASNTB_TO_TESTA.ASNTA" (NODE 2, NODE 1);
SET TABLES(NODE 1 "DBA");
CREATE QSUB SUBTYPE B FROM NODE TESTA.ASNTA SOURCE HAS LOAD PHASE I START AUTOMATICALLY YES TARGET LOAD TYPE 0;
Now run the script using asnclp command line
asnclp -f replication_setup.asn
This will create control tables, replication queue map and subscription for table DBA. Once done with above script now lets start the capture and apply programs on both sides.
Issue this commands using db2inst1 ID
nohup asnqcap capture_server=TESTA capture_schema=ASNTA &
nohup asnqcap capture_server=TESTB capture_schema=ASNTB &
nohup asnqapp apply_server=TESTA apply_schema=ASNTA &
nohup asnqapp apply_server=TESTB apply_schema=ASNTB &
Lets replicate the data now, Insert data from TESTA and look if its replicated to TESTB database.
[db2inst1@fedorabox mqm]$ db2 connect to TESTA
Database Connection Information
Database server = DB2/LINUXX8664 9.7.6
SQL authorization ID = DB2INST1
Local database alias = TESTA
[db2inst1@fedorabox mqm]$ db2 "insert into dba values(1,Murali,db2)"
DB20000I The SQL command completed successfully.
[db2inst1@fedorabox mqm]$ db2 "select * from dba"
ID NAME TOPIC
------- ---------- ----------
1. Murali db2
1 record(s) selected.
[db2inst1@fedorabox mqm]$ db2 connect to testb
Database Connection Information
Database server = DB2/LINUXX8664 9.7.6
SQL authorization ID = DB2INST1
Local database alias = TESTB
[db2inst1@fedorabox mqm]$ db2 "select * from dba"
ID NAME TOPIC
------- ---------- ----------
1. Murali db2
1 record(s) selected.
So the data is replicating and we just did it.... :) thats all with this tutorial on DB2 Q Replication.
In my next post i will post the common issues that i have encountered when did my first setup of Q Replication. People post your comments here ..... and lets start exploring more on Q Replication.
Sunday, April 9, 2017
DB2 Q Replication setup for an active active solution PART 1
DB2 Q Replication setup for an active active solution PART 1
How to setup DB2 Q Replication
We are about a setup DB2 Q Replication that demonstrates active active solution. Active - Active simply means changes happening at source should go to target and at same time changes happening at target should go to source.
High level steps:
1) Install DB2 9.7 on Fedora 18 OS - Im Fedora OS as its free edition supported by REDHAT community.
2) Install Websphere MQ 7.1 for messaging system between 2 DB2 databases.
3) Create MQ objects needed for active active Q replication.
4) setup a replication for a sample table to demonstrate active active replication.
Below is the setup of two databases named TESTA and TESTB for demonstration of active - active Q replication between two db2 databases. Below is how the setup look like.
Links to download the needed softwares
1) Fedora 18 or above ( Free copy ) from here :- http://fedoraproject.org/en_GB/get-fedora-all
2) DB2 9.7 AESE ( trail 90 days ) from here https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_us&source=swg-dm-db297trial&S_CMP=web_dw_rt_swd
3) Websphere 7.1 (trail 90 days ) from here :- www.ibm.com/webspheremq/downloads
Installation procedure of DB2 9.7 on Fedora OS
After installing fedora and Vmware tools you will be able to copy the downloaded trails files to the host machine to proceed with installation. An advice here when you try to copy to host machine, Use the command with sudo access ( systemctl mask tmp.mount ), This will turn off any filesystem from being mounted on /tmp, forcing it to be on / instead. To turn it on again, run ( systemctl unmask tmp.mount )
1) Its always a best practice to do a prerequisite check before installing DB2
[db2inst1@fedorabox server]$ cd server/
[db2inst1@fedorabox server]$ sudo sh db2prereqcheck
[sudo] password for db2inst1:
WARNING:
DBT3534W The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.
WARNING:
The 32-bit library file libpam.so is not found on the system.
Above you can see that there is a warning that libpam.so is missing. Now lets install it from internet. run sudo yum install pam-devel.i686 in your terminal
Ok lets run the prereqcheck again and see.
[db2inst1@fedorabox server]$ sudo sh db2prereqcheck
[sudo] password for db2inst1:
WARNING:
DBT3534W The db2prereqcheck utility determined that ASLR is set to ON and that this could cause issues with some tools.
above warning can be ignored.
2) now lets install the db2 using db2setup
[db2inst1@fedorabox server]$ sudo sh db2setup
we get a GUI prompt like ( shown below ) which will allow us to use various options for installation, Just go ahead proceed with all steps and at the end when you click finished , it will do the actual work of installing DB2 with the selected options
When all the steps are completed lets set the db2profile in user home directory add below 3 lines to profile file of db2inst1 ( run vi .bash_profile )
if [ -f /home/db2inst1/sqllib/db2profile ]; then
sh /home/db2inst1/sqllib/db2profile
fi
execute the profile file to take changes into effect
run . .bash_profile
3) Now lets start the instance.
[db2inst1@fedorabox ~]$ db2start
04/07/2014 15:17:17 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
Thats it with DB2 Installation on Fedora OS and we can proceed to step 2 which will be preceded in the next post as PART 2
Wednesday, April 5, 2017
dear downloders and visitors of blog 2 9 status active until implanting is done
dear downloders and visitors of blog 2 9 status active until implanting is done
Read This very important for you
Thank you very much for today
i get payment from adf 10$ my first ever online
well as you can see all woting in right corner are gone
thanks for all people ho did woting some thing will implant now
something will take some time so dont get angry on me
now about woting results :
1.Do you like adf script on http://httppein-zorg55new-forumnet.blogspot.com/
yes it good only 1 adf pops out - 2 (50%)
no i dont like it at all - 3 (75%)
adf pops every 5 sec it annoying like hell - 1 (25%)
dont put any script at all and work on games its fine as it now - 1 (25%)
well as you can see no i dont like it at all - 3 (75%) is winner by woting
so my decision is that i dont put at all adf script to this blog and upload news blog
however i will create another blog with deposit files only but i will add adf script on that when you come to blog you will see only 1 adf when you skip it you will be free from ads for 24 h however if you come next day again there will be only 1 adf again.
2. Change adf
am with idea that when i click on blog only 1 adf window pops out - 3 (60%)
change nothing - 3 (60%)
well its draw here so i dont have idea what to do if i remove adf i will not earn money also i will loss will to upload
so its double crossed sword
thats way i will create very soon another blog without 99% adf links as i told above
3.Do you like new rating system on blog and wordpressAwesome rating - 1 (33%)
Great rating - 1 (33%)
Good rating - 1 (33%)
i dont use it all - 0 (0%)
well what to say i think again draw lol well i will use this system anyway because is very good so please use it as you install game and tested.
4.Do you like wordpress site or forums
I like wordpress site - 1 (16%)
I like 1 forum - 1 (16%)
I like 2 forum - 1 (16%)
I like all sites - 3 (50%)
well what to say i will use all sites then but it will some time to make posts on all forums and wordpress
5.What you think about new look of post (redesigned)
awesome - 3 (37%)
Good - 6 (75%)
Bad - 1 (12%)
nothing special - 1 (12%)
redesign wins also it will started to implant from today so it will take some time to implant to all post
6.How much you like Adf shrink service
1 - 3 (50%)
2 - 1 (16%)
3 - 1 (16%)
4 - 2 (33%)
5 - 3 (50%)
about this well i know this is annoying but adf links is better then regular survway or password protected surways
when you download sommething thats isnt what you want
also in 2 weeks i will test one more service similar to adf but on another blog that will create for that
so guys and girls games are getting hot and even better every month however you can help me alot
i see some games are not downloded not only once so please download others game too as you play your game you download why is simple for each download part game file it become active more for 90 days so keep them downloding to help each other to stay online
also as you can see in blog post i added this (2.9 status active until implanting is done)
in other blog about news uploding you will see like this (23.4 status closed)
that means that text is no more active so also some time check that blog because all woting or some new news will be posted there i will add that blog now in sections next gba blog
this text will be active until implanting is done after that will be removed
also today i removed 7 text post
Subscribe to:
Posts (Atom)