You have seen me rant about Oracle’ provided virtual hostname solution before. If you have not, check it out here. In summary, Oracle provided solution basically asks you to change the physical hostname of the server to the virtual one, which effects no just oracle ebs, but everything running on that server.
In my earlier blog post, I outlined the steps to get virtual hostname working for 11i, R12.0 and R12.1 releases. Oracle EBS R12.2 is a special case, as it uses both 32bit and 64bit JDK. I am happy to tell you that I have a working virtualhostname solution that works with EBS R12.2. Thanks to Maris Elsins who figured this out.
In brief, the solution is to compile both 32bit and 64bit version of the fakehostname library and copy them to /usr/lib and /usr/lib64 directories with same name libfakehostname.so.1. And then set LD_PRELOAD to just libfakehostname.so.1 with out the absolute path. This way both 32bit and 64bit libraries pick up appropriate library corresponding to their architecture.
Here are the steps to implement the solution
wget https://github.com/nonspecialist/fakehostname/archive/master.zip#download the source code
[[email protected] ~]$
unzip master.zip
[[email protected] ~]$
#compile 32bit library
[[email protected] fakehostname-master]$ gcc -fPIC -m32 -shared -Wl,-soname,libfakehostname.so.1 -ldl -o libfakehostname.so.1 fakehostname.c
#compile 64bit library
[[email protected] fakehostname-master]$ gcc -fPIC -m64 -shared -Wl,-soname,libfakehostname64.so.1 -ldl -o libfakehostname64.so.1 fakehostname.c
ls libfakehostname*
[[email protected] fakehostname-master]$
libfakehostname64.so.1 libfakehostname.so.1
#copy the 32bit library to /usr/lib
[[email protected] fakehostname-master]$ sudo cp libfakehostname.so.1 /usr/lib
#copy 64bit library to /usr/lib64 with same name as 32bit library
[[email protected] fakehostname-master]$ sudo cp libfakehostname64.so.1 /usr/lib64/libfakehostname.so.1
#set LD_PRELOAD to the library name. Do not use the absolute path
[[email protected] ~]$ export LD_PRELOAD=”libfakehostname.so.1″#test the fake hostname
[[email protected] ~]$ hostname
apps.example.com
virtapps.example.com
8 Comments. Leave new
Hi Vasu,
To add. Maybe update this blog post of yours. There is an issue with Multi Apps-Tier setup.
Adding these two MYHOSTNAME and LD_PRELOAD variables to the sh profile are not taken by remote calls that ADOP is doing to remote slave nodes.
If you do from node1 ” ssh virtual-node2 “hostname” ” it will still return your physical hostname value from node2.
This is the nature of SSH which is not using login shell for direct remote call executions.
There are two options how to bypass it.
Option 1: (less secure) to configure ~/.ssh/rc file with same export commands.
-bash-4.2$ vi ~/.ssh/rc
-bash-4.2$ cat ~/.ssh/rc
export FAKEHOSTNAME=virtual-node2.virtualdomain
export LD_PRELOAD=libfakehostname.so.1
-bash-4.2$
This requires PermitUserRC to be enabled in your /etc/ssh/sshd_config.
Why this is less secure. Well… anybody can put there ANY command there and it will be executed by ssh.
Imagine having there ” rm -Rf /* “. :)
Option 2: to configure ~/.ssh/environment file with same environment variables to be added.
-bash-4.2$ vi ~/.ssh/environment
-bash-4.2$ cat ~/.ssh/environment
FAKEHOSTNAME=virtual-node2.virtualdomain
LD_PRELOAD=libfakehostname.so.1
-bash-4.2$
This requires PermitUserEnvironment to be enabled in your /etc/ssh/sshd_config.
This is way more safe, as environment variables are not so harmful, right? :)
One sshd restart, and it works.
bash-4.2$ ssh virtual-node2 “id ; hostname”
uid=501(applmgr) gid=500(dba) groups=500(dba)
virtual-node2.virtualdomain
bash-4.2$
And ” adop -validate ” is not throwing anymore errors.
Awesome solution and kudos to Maris, Vasu and Andrejs for figuring this out. Thanks Vasu for sharing this. This solution will greatly reduce the switch over time during the DR of EBS.
Hi,
I am getting the error
export LD_PRELOAD=/usr/lib/libfakehostname.so.1
ERROR: ld.so: object ‘/usr/lib/libfakehostname.so.1’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/usr/lib/libfakehostname.so.1’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/usr/lib/libfakehostname.so.1’ from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object ‘/usr/lib/libfakehostname.so.1’ from LD_PRELOAD cannot be preloaded: ignored.
How do resolve the issue?
Thanks
Ramesh Kandukuri
Vasu,
I have tried both options giving the full path and just the name of the file, both situations same error. Not sure what is missing?
Your solution looks a great and perfect match for EBS 12.2.9 situation of DR. We are looking back for your reply for the fix of the error
Thanks
Ramesh Kandukuri
If your notice carefully, the gcc compile commands are used to generate a 32bit library and a 64bit library. The newer version of Linux are default 64bit. So you might have to copy 64bit version of library to /usr/lib and 32bit version into /usr/lib32. Give it a try
Does this mean, using this I would be able to directly bring up the services on DR if they are in sync without even running autoconfig since we are using virtual hostnames?
Yes – it’s possible. But have to be planned, setup and tested very carefully to cover all eBS corks and features.
Hi Anand,
That is correct. You can check one of the slide decks we were presenting at Collaborate 19 conference – https://www.slideshare.net/AndrejsProkopjevs/optimize-dr-and-cloning-with-logical-hostnames-in-oracle-ebusiness-suite-oaug-collaborate-2019-edition