Monday, April 22, 2019

Failed to set up listener: SocketException: Address already in use

The following error in the /data/log/mongod.log is often seen when a new mongod instance is being setup.



The following step would help clean up and start a new mongod instance, note that these are only additional steps to take into considerations apart from the standards tasks you would do to redirect your data files, log files, port number etc in you mongod.conf

Issue the following command to determine active mongo connections on the port being used.

sudo lsof -iTCP -sTCP:LISTEN -n -P


Kill the PID's that pertain to mongo processes and restart the instance.
This could be one way to resolve the error.

Cheers!

Sunday, April 23, 2017

Create and mount /u01 on guest linux using Virtualbox


While the VM is powered off , add a VDI (Virtual Disk Image) as shown below-


I have added a 20GB disk for the demo-


Power up the VM and login as root to perform the below tasks -

1. fdisk -l  (to list the existing partitions)

      The added disk has been detected as shown below


2. fdisk /dev/sdg  (create a disk partition on the disk we attached)

      Double check to see no partitions are created (p option to print partitions)



3. Create partition (using the same fdisk utility)
         Following fdisk options used int he snapshot below-
                   n   add a new partition
                   p   to select primary partition (1-4)
                   w   write table to disk and exit


          To verify partition is created run the fdisk /dev/sdg with 'p' option to print the partitions.

4. Now that we have the partition /dev/sdg1 created its time we format the disk in ext4 filesystem as follows -



5. Go ahead and mount the filesystem !


6. To ensure the mount is persistent even after a reboot don't forget to update the /etc/fstab


Thursday, April 6, 2017

Oracle Virtualbox Guest OracleLinux Network settings Bridged adapter

Setup-
Oracle VirtualBox 5.1
Guest: OracleLinux R6-U3 (6.3v)
Host: Windows 10

The following setup is for the guest Linux server to access host WiFi connectivity using a bridged adapter.

Step 1-
Ensure the following settings are in place in the Virtualbox configurations,
1. Promiscuous Mode being an important one usually set to 'Deny'.
2. Use Cable connected even though the host uses wireless.


Step 2-
Make the below change on the Guest OS,
- Here eth2 is my adapter3 fromt he previous snapshot.
- The address mentioned must be of the same IP range as on the host (run ipconfig on the windows host) in my case it was in the range of 192.168._.__
- The gateway is the router address and can be determined from the ipconfig out put in windows, labelled as Default Gateway.



Step 3-
Restart network services and retry !





Wednesday, February 5, 2014

Wait Event: Pipe put


Observation -

Your AWR or ASH report would show 'pipe put' wait event as one of the top user events.


Event Event Class %Activity Avg Active Sessions
pipe put Concurrency 99.97 1.00

The DBMS_PIPE package lets two or more sessions in the same instance communicate. Oracle pipes are similar in concept to the pipes used in UNIX, but Oracle pipes are not implemented using the operating system pipe mechanisms.

Furher details in the AWR report showed the DBMS_PIPE.SEND_MESSAGE procedure witnessed 100pc activity.


PLSQL Entry Subprogram % Activity PLSQL Current Subprogram % Current
UNIXCMD 100.00 SYS.DBMS_PIPE.SEND_MESSAGE 100.00


Solution -

If the issue was abrupt and was working well before, check to clear the existing pipe in use.

SQL > Select * from v$db_pipe;

## Purge Pipe contents.

SQL > exec dbms_pipe.purge('Name of pipe');commit;

## Reset pipe buffer.

SQL > Exec dbms_pipe.reset_buffer;commit;

Reinitiate the sessions/job once done.

Let me know if it helps !

Monday, January 20, 2014

Hive for Hadoop - FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient

Hive for Hadoop

Complete Error -

hive>select count(1) from temp_table;
FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

Resolution -

The below steps should help resolve the error -

1. Under hive/bin directory goto metastore_db directory where the hive metadata is stored.

drwxr-xr-x 3 hdd1 root   4096 Jan 15 11:01 ext
drwxr-xr-x 5 hdd1 hddba  4096 Jan 16 11:44 metastore_db
-rw-r--r-- 1 hdd1 hddba 38518 Jan 16 11:44 derby.log
[hdd1@kchjovm41 bin]$ cd metastore_db

2. You should see two .lck files created

[hdd1@kchjovm41 metastore_db]$ ls -ltr
total 48
drwxr-xr-x 2 hdd1 hddba 4096 Jan 16 10:10 log
-rw-r--r-- 1 hdd1 hddba    4 Jan 16 10:10 dbex.lck
-rw-r--r-- 1 hdd1 hddba  857 Jan 16 10:10 service.properties
drwxr-xr-x 2 hdd1 hddba 4096 Jan 16 10:10 seg0
drwxr-xr-x 2 hdd1 hddba 4096 Jan 16 11:44 tmp
-rw-r--r-- 1 hdd1 hddba   38 Jan 16 11:44 db.lck

3. Rename the .lck files

[hdd1@kchjovm41 metastore_db]$ mv dbex.lck dbex.lck1
[hdd1@kchjovm41 metastore_db]$ mv db.lck db.lck1
[hdd1@kchjovm41 metastore_db]$

4. Retry the hive sql , should work fine.

Let me know if it helps - Thank you

Monday, May 6, 2013

ssh keys RSA password-less authentication

Quick steps to implement password-less authentication.

Notes:
1. Below steps are for a home environment and hence passphrase is not used.
2. DSA is more secured than RSA.

-On source server - homeserver1

Login to the user account for which  password-less authentication needs to be set , in this case oracle user.


[oracle@homeserver1 .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):  ##Hit enter for keys to be placed at default location or mention desired path.
Enter passphrase (empty for no passphrase):  ##Recommended to use a passphrase
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
7b:34:24:c6:f6:76:ad:ea:79:aa:71:81:fd:e5:cd:44 oracle@homeserver1.oracle

## Public and private keys are generated in default path /home/oracle/.ssh

[oracle@homeserver1 .ssh]$ ls -ltr
-rw-r--r--  1 oracle oinstall 235 May  7 00:20 id_rsa.pub
-rw-------  1 oracle oinstall 887 May  7 00:20 id_rsa


-On destination server - homeserver2

Login to the user account for which  password-less authentication needs to be set , in this case oracle user.

Perform same steps as done on homeserver1.

Copy id_rsa.pub generated on homeserver1 as authorized_keys on homeserver2

[oracle@homeserver2 .ssh]$ ls -ltr
total 24
-rw-r--r--  1 oracle oinstall 235 May  7 00:21 id_rsa.pub
-rw-------  1 oracle oinstall 883 May  7 00:21 id_rsa
-rw-r--r--  1 oracle oinstall 235 May  7 00:22 authorized_keys

Similarly copy id_rsa.pub generated on  homeserver2 as authorized_keys on homeserver1.

[oracle@homeserver1 .ssh]$ ls -ltr
-rw-r--r--  1 oracle oinstall 235 May  7 00:21 id_rsa.pub
-rw-------  1 oracle oinstall 883 May  7 00:21 id_rsa
-rw-r--r--  1 oracle oinstall 235 May  7 00:22 authorized_keys

Test the connection both ways..

[oracle@homeserver2 .ssh]$ ssh oracle@homeserver1
Last login: Tue May  7 00:24:37 2013 from homeserver2.oracle
[oracle@homeserver1 ~]$ 

[oracle@homeserver1 .ssh]$ ssh oracle@homeserver2
Last login: Tue May  7 00:23:31 2013 from homeserver1.oracle
[oracle@homeserver2 ~]$


Hence works !

ssh: connect to host port 22: No route to host

I had this error after i had implemented ssh rsa password less authentication( refer my next post for steps to implement ssh rsa password less authentication).

[oracle@homeserver1 .ssh]$ ssh oracle@homeserver2
ssh: connect to host homeserver2 port 22: No route to host

I had firewall enabled which had restriction to port 22 on server homeserver2.

Below are the commands to check the status and turn off firewall.

[root@homeserver2 ~]# /sbin/service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
[root@homeserver2 ~]# /sbin/service iptables status
Firewall is stopped.

After which i was able ssh to my remote server homeserver2 from homeserver1 successfully.

[oracle@homeserver1 .ssh]$ ssh oracle@homeserver2
Last login: Tue May  7 00:23:31 2013 from homeserver1.oracle
[oracle@homeserver2 ~]$