Thursday, 31 May 2018

DB2 Federation between two DB2 databases on same instance

Step 1:
 
Go to db2 prompt
 
db2=>

Step 2: (Optional) Create database if necessary
 
create database Tom
 
create database Jerry
Step 3: Connect to DB1 and create table (Example Tom) (Optional)
 
connect to tom
 
create table db2inst1.tab1 (cod1 int)
 
insert into db2inst1.tab1 values (1)

Step 4: Connect to DB2 and create table (Example Jerry)
 
connect to jerry
 
create table db2inst1.tab2 (name1 char)
 
insert into db2inst1.tab2 values ('a')

Step 5: Create server and mappings in 1st DB (Tom) to access 2nd DB (Jerry)
connect to tom
 

create server fedserver TYPE DB2/UDB VERSION 10.5 WRAPPER drda  AUTHORIZATION "db2inst1" password "password" OPTIONS(DBNAME 'jerry')
 
create user mapping for db2inst1 SERVER fedserver OPTIONS(REMOTE_AUTHID 'db2inst1',REMOTE_PASSWORD 'password')
create nickname mytable for fedserver.db2inst1.tab1

Step 6: 

Executing Select statement from 1st Db (Tom) to query results from 2nd DB (Jerry)
 
select * from mytable

--
Regards
Sandeep C

Wednesday, 24 January 2018

Users from LDAP nested groups don't appear in BPM Process Admin Console

BPM uses the WebSphere UserRegistry.getUsersForGroup() call to retrieve user members of nested groups.

In order to get nested members from the API call getUsersForGroup(), you need to add/set a custom property:

"com.ibm.ws.wim.adapter.ldap.returnNestedNonGroupMembers" with value "true".

In order to set this property, do the following:

1) Stop all the servers and node agents.

2) From the deployment manager bin directory.

#./wsadmin.sh

Run below commands:

$AdminTask setIdMgrCustomProperty { -id my_Ldap_Repository_Id -name com.ibm.ws.wim.adapter.ldap.returnNestedNonGroupMembers -value true}

$AdminConfig save

3) Sync your nodes as needed.

4) Start your servers.


Thursday, 27 July 2017

Using a value file in a parameter set in Information Server DataStage

Question

How do I create and use a value file within a parameter set in DataStage?

Answer

Using a value file in a parameter set allows you to set values of a parameter dynamically. For Example:

  • Job A updates the value file. Job B uses a parameter set that points to that value file.
  • When moving jobs from development to test or production you can update the value file to reflect different values for the different environments without having to recompile the job.

To create a new Parameter Set, select File, New and select "Create new Parameter Set"

This will Launch a Dialog shown below:

Fill out the appropriate information on the General tab and the proceed to the Parameters Tab:




In this tab, enter in the Parameters you wish to include in this Parameter Set. Note that you can also add existing Environmental Variables.



The last tab, Values, allows you to specify a Value File name. This is the name of the file that will automatically be created on the Engine tier. This tab also allows you to view/edit values located in the value file.

Click OK to save the Parameter set.

Once the Parameter Set is created, you can view or edit the Value file on the Engine tier. The value file can be found in the following location ../Projects/<project name>/ParameterSets/<Parameter Set Name>. For example:
$ pwd
/opt/IBM/InformationServer/Server/Projects/PROJECT_NAME/ParameterSets/Param_test
$ ls
Param_test_data
$ more Param_test_data
Database=SYSIBM
Table=SYSTABLES
$

Any changes made to the value file will be populated to the Parameter Set automatically.

​​

A DataStage job does not use the new value that is put in the Parameter set.

Problem(Abstract)

A DataStage job does not use the new value that is put in the Parameter set.

Cause

If you make any changes to a parameter set object, these changes will be reflected in job designs that use this object up until the time the job is compiled. The parameters that a job is compiled with are the ones that will be available when the job is run (although if you change the design after compilation the job will once again link to the current version of the parameter set).

Diagnosing the problem

Examine the log entry "Environment variable settings" for parameter sets. If the parameter set specifies the value "(As predefined)", the parameter set is using the value that was used during the last compile.

Resolving the problem

If the value of the parameter set may be changed, you should specify a Value File for the parameters or set the parameters in the parameter set (including encrypted parameters) to $PROJDEF.

​​

How to set default values for Environment Variables without re-compiling DataStage jobs

Question

Is it possible to set/change the default values for an environment variable without re-compiling the DataStage job?

Answer

Yes, it is possible to set/change the default values for an environment variables without recompiling the job.

You can manage all of your environment variables from the DataStage Administrator client. To do this follow these steps:

  1. Open the Administrator client and select the project you are working in and click Properties.
  2. On the General tab click Environment.
  3. Create a new environment variable under the "User Defined" section or update the variable if it exists. Set the value of the variable to what want the DataStage job to inherit.
  4. Once you do this, close the Administrator Client so the variable is saved.
  5. Next, open the DataStage Designer client and navigate to the Job Properties.
  6. Add the environment variable name that you just created in the DataStage Administrator Client.
  7. Set the value of the new variable to $PROJDEF. This will inherit whatever default value you have set in the Administrator client. This will also allow you to update that default value in the Administrator client without having to recompile the job.

Wednesday, 26 July 2017

How to fix missing and underreplicated blocks - HDFS

$ su - <$hdfs_user> 

$ hdfs fsck / | grep 'Under replicated' | awk -F':' '{print $1}' >> /tmp/under_replicated_files

$ for hdfsfile in `cat /tmp/under_replicated_files`; do echo "Fixing $hdfsfile :" ; hadoop fs -setrep 3 $hdfsfile; done

In above command, 3 is the replication factor. If you are using single datanode, it must be 1.


 




Friday, 2 June 2017

How to Get Started With Cloudera docker

Step 1 — Installing Docker

The Docker installation package available in the official Ubuntu 16.04 repository may not be the latest version. To get the latest and greatest version, install Docker from the official Docker repository. This section shows you how to do just that.

But first, let's update the package database:

  • sudo apt-get update

Now let's install Docker. Add the GPG key for the official Docker repository to the system:

Add the Docker repository to APT sources:


Update the package database with the Docker packages from the newly added repo:

  • sudo apt-get update

Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo:

  • apt-cache policy docker-engine


You should see output similar to the follow:

Output of apt-cache policy docker-engine
docker-engine:    Installed: (none)    Candidate: 1.11.1-0~xenial    Version table:       1.11.1-0~xenial 500          500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages       1.11.0-0~xenial 500          500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages    

Notice that docker-engine is not installed, but the candidate for installation is from the Docker repository for Ubuntu 16.04. The docker-engine version number might be different.

Finally, install Docker:

  • sudo apt-get install -y docker-engine


Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it's running:

  • sudo systemctl status docker

The output should be similar to the following, showing that the service is active and running:



Output
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2016-05-01 06:53:52 CDT; 1 weeks 3 days ago Docs: https://docs.docker.com Main PID: 749 (docker)

Installing Docker now gives you not just the Docker service (daemon) but also the docker command line utility, or the Docker client. We'll explore how to use the docker command later in this tutorial.


Step 2 — Pull clodera docker image

docker pull cloudera/quickstart:latest






Step 3 — Start or Run Cloudera Docker image


docker run --hostname=quickstart.cloudera --privileged=true -t -i -p 8888:8888 -p 80:80 cloudera/quickstart /usr/bin/docker-quickstart



STEP 3:
browse hue localhost:8888
Optionally start services