Difference between revisions of "Conf/Db"

From AOLserver Wiki
Jump to navigation Jump to search
(Created page with '== ns_section "ns/db/drivers" == ; sybase_driver : Use nsext.so for a proxy daemon ; postgres_driver :…')
 
 
Line 1: Line 1:
 
== ns_section "ns/db/drivers" ==
 
== ns_section "ns/db/drivers" ==
   
+
part of [[Conf|AOLServer Config Reference]]
; [[Conf/Parameters/sybase_driver|sybase_driver]]
 
: Use nsext.so for a proxy daemon
 
  
; [[Conf/Parameters/postgres_driver|postgres_driver]]
+
There are database drivers for a number of popular databases [[Modules#Database_Drivers]]
: An internal driver
 
  
; [[Conf/Parameters/localdaemon|localdaemon]]
+
  ns_section "ns/db/drivers"
: Name of the proxy daemon executable
+
    ns_param  postgres_driver nspostgres.so
  
; [[Conf/Parameters/param|param]]
+
You can define as many pools as you need.
: Usually the $SYBASE env var
 
  
; [[Conf/Parameters/sybase_pool|sybase_pool]]
+
    ns_section "ns/db/pools"
: Name of the proxy daemon executable
+
    ns_param  postgres_pool  "Postgres Pool"
  
; [[Conf/Parameters/postgres_pool|postgres_pool]]
+
Configure this pool
: Usually the $SYBASE env var
 
  
; [[Conf/Parameters/driver (SP)|driver (SP)]]
+
  ns_section "ns/db/pool/postgres_pool"
+
    ns_param  driver         postgres_driver
 +
    ns_param  datasource      HOSTNAME:PORT:database_name
 +
    ns_param  user            user_name
 +
    ns_param  password        password
 +
    ns_param  connections    5        ;# The maximum number of db handles to open
 +
    ns_param  logsqlerrors    true      ;# Verbose SQL query error logging
 +
    ns_param  verbose        false    ;# Verbose error logging
 +
    ns_param  maxidle        600      ;# Max time to keep idle db connections open
 +
    ns_param  maxopen        3600      ;# Max time to keep active db connections open
  
; [[Conf/Parameters/datasource (SP)|datasource (SP)]]
+
 
+
'''Loading the nsdb module'''
 
+
 
; [[Conf/Parameters/user (SP)|user(SP)]]
+
The nsdb.so module must be loaded in the virtual server
 
 
 
; [[Conf/Parameters/password (SP)|password(SP)]]
 
 
 
; [[Conf/Parameters/connections (SP)|connections (SP)]]
 
 
 
; [[Conf/Parameters/logsqlerrors (SP)|logsqlerrors(SP)]]
 
:Verbose SQL query error logging
 
 
 
; [[Conf/Parameters/verbose(SP)|verbose(SP)]]
 
:Verbose error logging
 
 
 
; [[Conf/Parameters/maxidle (SP)|maxidle(SP)]]
 
:Max time to keep idle db conn open
 
 
 
; [[Conf/Parameters/maxopen (SP)|maxopen(SP)]]
 
:Max time to keep active db conn open
 
 
 
 
 
; [[Conf/Parameters/driver (PG)|driver (PG)]]
 
 
 
 
; [[Conf/Parameters/datasource (PG)|datasource (PG)]]
 
 
 
 
; [[Conf/Parameters/user (PG)|user(PG)]]
 
 
 
 
; [[Conf/Parameters/password (PG)|password(PG)]]
 
 
 
; [[Conf/Parameters/connections (PG)|connections (PG)]]
 
 
 
; [[Conf/Parameters/logsqlerrors (PG)|logsqlerrors(PG)]]
 
:Verbose SQL query error logging
 
 
 
; [[Conf/Parameters/verbose(PG)|verbose(PG)]]
 
:Verbose error logging
 
 
 
; [[Conf/Parameters/maxidle (PG)|maxidle(PG)]]
 
:Max time to keep idle db conn open
 
 
 
; [[Conf/Parameters/maxopen (PG)|maxopen(PG)]]
 
:Max time to keep active db conn open
 
  
 +
  ns_section "ns/server/${server_name}/modules"
 +
      ns_param nsdb ${bindir}/nsdb.so
  
 
'''Accessing DB pools'''
 
'''Accessing DB pools'''
; [[Conf/Parameters/pools |pools]]
 
:Wildcard gives access to all
 
 
; [[Conf/Parameters/defaultpool|defaultpool]]
 
 
'''Modules to load'''
 
 
; [[Conf/Parameters/nssock |nssock]]
 
 
; [[Conf/Parameters/nsssl |nsssl]]
 
 
; [[Conf/Parameters/nscp |nscp]]
 
 
; [[Conf/Parameters/nslog|nslog]]
 
 
; [[Conf/Parameters/nscgi|nscgi]]
 
 
; [[Conf/Parameters/nsperm |nsperm ]]
 
 
 
  
'''Loading a TCL module'''
+
In the case of virtual servers you can give different virtual
 +
servers access to different databases, or you can let them access
 +
them all.
  
; [[Conf/Parameters/tcl_module |tcl_module]]
+
  ns_section "ns/server/${server_name}/db"
 +
    ns_param pools          *            ;# Wildcard gives access to all
 +
    ns_param defaultpool    postgres_pool

Latest revision as of 20:39, 22 December 2011

ns_section "ns/db/drivers"

part of AOLServer Config Reference

There are database drivers for a number of popular databases Modules#Database_Drivers

 ns_section "ns/db/drivers"
   ns_param   postgres_driver nspostgres.so

You can define as many pools as you need.

   ns_section "ns/db/pools"
   ns_param   postgres_pool  "Postgres Pool"

Configure this pool

 ns_section "ns/db/pool/postgres_pool"
   ns_param   driver          postgres_driver
   ns_param   datasource      HOSTNAME:PORT:database_name
   ns_param   user            user_name
   ns_param   password        password
   ns_param   connections     5         ;# The maximum number of db handles to open
   ns_param   logsqlerrors    true      ;# Verbose SQL query error logging
   ns_param   verbose         false     ;# Verbose error logging
   ns_param   maxidle         600       ;# Max time to keep idle db connections open
   ns_param   maxopen         3600      ;# Max time to keep active db connections open


Loading the nsdb module

The nsdb.so module must be loaded in the virtual server

 ns_section "ns/server/${server_name}/modules"
     ns_param nsdb ${bindir}/nsdb.so

Accessing DB pools

In the case of virtual servers you can give different virtual servers access to different databases, or you can let them access them all.

 ns_section "ns/server/${server_name}/db"
   ns_param pools          *            ;# Wildcard gives access to all
   ns_param defaultpool    postgres_pool