Multiple instances
Posted in 2006
Asker wanted to run two IDS instances on one box for development and asked how onstat picks an instance, how to switch between servers, and whether onstat can show the server name. Replies confirmed onstat uses the current INFORMIXSERVER environment variable, and recommended per-instance environment scripts/shell functions sourced from .profile (or aliases) that set INFORMIXSERVER, INFORMIXDIR, PATH and especially ONCONFIG (e.g. onconfig.<instance>). For visibility, suggestions included 'onstat -g env', echoing $INFORMIXSERVER, or embedding it in PS1 or the terminal title bar.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: General Discussion
Greetings, I have been asked to setup two DB servers on the same box for
development purposes. I have two questions related to multiple DB
servers:
1. When "onstat -" is run, is IDS returning the status for the DB server
based on the current value of the environment variable, INFORMIXSERVER?
2. What would be the best way to switch between each DB server; ie,
scripts, separate user accounts which would set the appropriate
environment variables to point to the proper DB server, ...?
3. Maybe a feature request would be to have onstat return the name of
the DB server it is referencing?
Your suggestions regarding questions 1 and 2 would be greatly
appreciated.
Thanks for your time.
Mike Badar
ESRI-Denver
1 International Court
Broomfield, CO 80021-3200
303-449-7779
mbadar@esri.com
www.esri.com
"Mike Badar" <mbadar@esri.com> wrote in message
news:mailman.377.1138833674.740.informix-list@iiug.org...
Greetings, I have been asked to setup two DB servers on the same box for
development purposes. I have two questions related to multiple DB
servers:
>> 1. When "onstat -" is run, is IDS returning the status for the DB server
based on the current value of the environment variable, INFORMIXSERVER?
Yup.
>> 2. What would be the best way to switch between each DB server; ie,
scripts, separate user accounts which would set the appropriate
environment variables to point to the proper DB server, ...?
Just a environment variable file, say /opt/informix/V9INST3, which you
source each time you want to set or change your environment. You can even
set up meaningful aliases to these in your .profile, eg alias DEV='.
/opt/informix/V9INST4'.
>> 3. Maybe a feature request would be to have onstat return the name of
the DB server it is referencing?
onstat -g env, and probably others, already does. But why not just use env?
See commentary below,
- TJG
Mike Badar wrote:
> Greetings, I have been asked to setup two DB servers on the same box for
> development purposes. I have two questions related to multiple DB
> servers:
>
> 1. When "onstat -" is run, is IDS returning the status for the DB server
> based on the current value of the environment variable, INFORMIXSERVER?
>
Yes.
> 2. What would be the best way to switch between each DB server; ie,
> scripts, separate user accounts which would set the appropriate
> environment variables to point to the proper DB server, ...?
>
Personally, I prefer scripts, because you should really be changing
INFORMIXSERVER _and_ PATH _and_ INFORMIXDIR all at the same time.
Although your mileage may vary depending on applications, etc.
> 3. Maybe a feature request would be to have onstat return the name of
> the DB server it is referencing?
>
There's always "echo ${INFORMIXSERVER}" but if you're using ksh (or, I
imagine, bash), it's not terribly difficult to embed the current
INFORMIXSERVER into your prompt, so you'll know what it is.
> Your suggestions regarding questions 1 and 2 would be greatly
> appreciated.
>
> Thanks for your time.
>
> Mike Badar
> ESRI-Denver
> 1 International Court
> Broomfield, CO 80021-3200
> 303-449-7779
> mbadar@esri.com
> www.esri.com
please do not forget ONCONFIG. Superboer.
I use command prompt to see my current INFORMIXSERVER.
export PS1='[$USER@$INFORMIXSERVER]'
> Greetings, I have been asked to setup two DB servers on the same box for
> development purposes. I have two questions related to multiple DB
> servers:
>
> 1. When "onstat -" is run, is IDS returning the status for the DB server
> based on the current value of the environment variable, INFORMIXSERVER?
>
> 2. What would be the best way to switch between each DB server; ie,
> scripts, separate user accounts which would set the appropriate
> environment variables to point to the proper DB server, ...?
>
> 3. Maybe a feature request would be to have onstat return the name of
> the DB server it is referencing?
>
> Your suggestions regarding questions 1 and 2 would be greatly
> appreciated.
>
> Thanks for your time.
>
> Mike Badar
> ESRI-Denver
> 1 International Court
> Broomfield, CO 80021-3200
> 303-449-7779
> mbadar@esri.com
> www.esri.com
Add two functions to the .profile that export the relevant Informix
environment variables and PS1. Then from the command line execute each
function when required
Regards
Colin
There are 10 types of people in the world, those that understand binary and
those that don't
>From: "SaltTan" <SaltTan@gmail.com>
>To: informix-list@iiug.org
>Subject: Re: Multiple instances
>Date: 2 Feb 2006 02:22:23 -0800
>
>I use command prompt to see my current INFORMIXSERVER.
>
>export PS1='[$USER@$INFORMIXSERVER]'
>
> > Greetings, I have been asked to setup two DB servers on the same box for
> > development purposes. I have two questions related to multiple DB
> > servers:
> >
> > 1. When "onstat -" is run, is IDS returning the status for the DB server
> > based on the current value of the environment variable, INFORMIXSERVER?
> >
> > 2. What would be the best way to switch between each DB server; ie,
> > scripts, separate user accounts which would set the appropriate
> > environment variables to point to the proper DB server, ...?
> >
> > 3. Maybe a feature request would be to have onstat return the name of
> > the DB server it is referencing?
> >
> > Your suggestions regarding questions 1 and 2 would be greatly
> > appreciated.
> >
> > Thanks for your time.
> >
> > Mike Badar
> > ESRI-Denver
> > 1 International Court
> > Broomfield, CO 80021-3200
> > 303-449-7779
> > mbadar@esri.com
> > www.esri.com
>
>_______________________________________________
>Informix-list mailing list
>Informix-list@iiug.org
>http://www.iiug.org/mailman/listinfo/informix-list
I put the following in my unix profile on the server. I use the bash
shell. that way it is always available for me.
#<begin insert into profile>
function sett {
if [ $# -ne 1 ] ; then
printf "\\n\\nUsage: sett instance_name\\n\\n" 1>&2
return 1
fi
if [ $(grep "^$1" $INFORMIXDIR/etc/sqlhosts | wc -l) -ge 1 ] ; then
export INFORMIXSERVER=$1
export ONCONFIG=onconfig.$1else
printf "\\n\\n%s - is not in the sqlhosts file.\\n\\n" "$1" 1>&2
return 2
fi
}
PROMPT_COMMAND='echo -n "^[]0;$HOST[$INFORMIXSERVER]:$PWD^G"'
#<end profile>
It is used as "sett <instance-name>". Notice the cheat here is that my
onconfig is named onconfig.<instance_name>
The PROMPT_COMMAND sets the title bar of the telnet window to
"<hostname>[<database_server>]:<current_directory>"
This helps you quickly figure out which instance you are pointing to.
^[ is typed into the string as the esc (escape key) and ^G is
control-G. This is a vt-100 command I think so you can google for them.
If you can't get the heading to work correctly just set the prompt to
the above without all of the escape characters. This way every prompt
will show you what your current instance is.
There is probably a way to set the title bar of a monitor in a more
standard way with stty. Which I would be happy to hear about.
Related threads
- Posting from the Informix-list
- Migrating from IDS 9.40.UC6 to 11.50.UC3
- Ip for a network session
- questions onstat -g