2. instance setup

Use the new function of the instance service to create Informix instances.

Create a new default infx instance called infx01. 

infx inst func=new newinst=infx01

This creates the directories and files needed by infx, adds entries to the sqlhosts file and creates a new onconfig file. 

initialize instance

Use the init function of the instance service to initialize the new instance, and bring it online.

infx inst infx01 func=init squiggle=yes 

squiggle=yes is a special token that you have to add to some commands as confirmation that you really mean it.

instance

You now have a blank instance called infx01.

infx01@bobii:/home/informix>infx status

infx01@bobii(192.168.0.34) 11.50.FC7DE online up: 00:00:28

host                   user               memory          space         write           prof
name  bobii     total    15      total  186.94mb  total  0.10gb  total    638   read  99.66%
 cpu  2/2         max    15   resident  120.85mb   free  0.01gb     fg      0  write  95.37%
 mem  3.89gb   active    15    virtual   65.54mb   temp  0.00gb    lru    597  ckpts       2
free  0.26gb  threads    15  virt free   36.54mb   free  0.00gb  chunk     41  waits       0

space  pg  status  chks  size mb  used mb  free mb  used %  read mb  write mb
root   2k  OK         1   100.00    87.82    12.18  87.82%     0.27     88.83

took: 0.07secs template: /infx/template/infx-cli/infx-cli-status.htmlt

config

infx uses config files to control exactly what is created for a new instance. The included file infx-config.inst specifies a default infx instance. Make your own .inst files to create customized instances.

infx-config.inst

The supplied file, /infx/etc/infx-config.inst is the most basic prototype for an instance. You can use this as a basis to create instances and then manually modify them to your needs. You can also create new versions of this ini file to create whatever instance layouts you require.

Information about this file is here: infx-config.inst

infx-small.onconfig

This supplied file, /infx/etc/infx-small.onconfig is an example template to generate a new onconfig file. You can use this template and make changes manually to the resulting onconfig file. Or you can create your own templates and use them when creating new instances.

Information about this file is here: onconfig template

When using config files, always copy the files from /infx/etc to /infx/local/etc before editing.

using different config

The new function supports parameters that allow you to override the default config files and build the instance based on a different definition.

infx inst func=new newinst=infx01 config=myconfig onconfig=myonconfig servernum=10 sw=XXX

 parameter  description
 config=myconfig  instead of /infx/etc/inst-config.ini use the file /infx/etc/myconfig.ini
 onconfig=myconfig  instead of /infx/etc/infx.onconfig use the file /infx/etc/myonconfig.onconfig
 servernum=10  use server number 10, instead of calculating the next available number
 sw=XXX  use /infx/sw/XXX instead of the informixdir specified in the config file

default instance

Default instance layout, created under /infx/inst/infx01

infx inst func=new newinst=infx01

 location  * variable  purpose
 backup  BACKUPDIR  directory to store backups
 backup/dbs    ontape dbspace backups
 backup/logs
 ontape logical log backups
 chks  CHKDIR  directory to contain chunk files
 chks/root.001    new file to initialize root space.
 dump    specified in onconfig template for diagnostic dumps
 etc    directory to contain instance specific config files
 infomrixdir  INFORMIXDIR  link to /infx/sw/latest
 logs  LOGDIR  service and other command output
 tmp  TMPDIR  temporary files used by services

Every infx instance must have at least an etc, informixdir, logs and tmp.
* Where there is a variable listed, you can override the default location and specify an absolute path

directories, links & files

This is the section of the infx-config.inst that defined the directories, files and links. All paths are relative to the instance specific directory. Specify absolute paths for files outside of that.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; instance directories, create under instance dir /infx/inst/${inst}
[[ dir path="chks" mode="755" note="where to store chunk files" ]]
[[ dir path="backup" mode="755" note="backup files" ]]
[[ dir path="backup/db" mode="775" note="dbspace backup files" ]]
[[ dir path="backup/logs" mode="775" note="logical log backup files" ]]
[[ dir path="logs" mode="755" note="instance, command and service log files" ]]
[[ dir path="etc" mode="755" note="instance specific config files" ]]
[[ dir path="tmp" mode="755" note="temporary file location" ]]
[[ dir path="dump" mode="755" note="instance diagnostic dumps, can be large" ]]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; instance links created within instance tree
[[ link path="informixdir" source="/infx/sw/latest" note="informix product binaries" ]]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; files created within instance tree
[[ file path="chks/root.001" mode="660" note="create file for root chunk" ]]
[[ file path="informixdir/etc/sysadmin/stop" mode="660" note="stop dbworker/dbscheduler" ]]
[[ file path="etc/allow-autostart" mode="660" note="start instance when server starts" ]]
[[ file path="etc/allow-autobackup" mode="660" note="include instance in auto backups" ]]

sqlhosts

This section describes what sqlhosts entries will be created for the instance. This step is skipped if the entries are already in the sqlhosts file.

If you want to create multiple instances with TCP connections, you need to assign a unique port for each instance. When you specify a base port number, infx adds the server number to generate a unique port for the instance.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; create sqlhosts entries
; create shared memory connection
[[sqlhosts]]
server=${newinst}
protocol=onipcshm
host=${host}
service=${newinst}
options=
note=local shared memory connection

; create tcp based sqlhosts entry
; ${port} translated to $baseport+$servernum
[[sqlhosts]]
server=${newinst}tcp
protocol=onsoctcp
host=${host}
baseport=62000
service=${port}
options=
note=connect via tcp

The sqlhosts file is created in the INFORMIXDIR by default, you can override this in the config.ini file and specify a central location.

Set central sqlhosts file for all instances on this host, in /infx/etc/config.ini

INFORMIXSQLHOSTS = /infx/etc/sqlhosts

onconfig

A new onconfig file is generated for the instance based on the onconfig template. This file has exactly the same format as the standard onconfig file. This step is skipped If an onconfig file already exists for this instance.

The following tokens will be replaced when the onconfig file is generated.

 token  description
 [[INST]  new instance name e.g. DBSERVERNAME [[INST]]
 [[SERVERNUM]]  new instance server number e.g. SERVERNUM [[SERVERNUM]]

The onconfig file is created in the INFORMIXDIR and is named onconfig.${inst}.