|
Size: 3314
Comment:
|
Size: 3449
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 87: | Line 87: |
1. dblog.dat does not get re-initialised. You will need to run {{{rolldblog}}} to initialise dblog.dat Maybe add to backup script |
SQL Mirroring
How it works
- A record in one of the .dat files is altered. This includes changes to quantities, balances. This includes some changes that polling would not normally send/receive.
- The type of record and the record number is recorded in dblog.dat
log2odbc takes unprocessed dblog.dat entries, generates SQL query for the whole record and sends it via ODBC
- dblog.dat gets updated so that newly processed entries are not re-processed.
Installation
This instruction will help you understand how CONTROL and SQL database works together. Also this instruction will be helpful to troubleshoot or implementing SQL database for the client.
All control data files are stored in .dat files and .idx files are indexes for the .dat files.
Steps to configure SQL database and control
- Install SQL database. This could be either on same server that Control resides on or a different server.
# yum install postgresql
- Download and install odbc driver for your database.
# yum install unixODBC
- Configure /etc/odbc.ini which you will need to configure:
- [xxxxxx]: This is a ODBC connection name
- Driver: This is ODBC driver that is used to connect to database (different for different SQL vedors)
- Database: Name of database that you created
ServerName: The IP of the SQL server (possibly this machine)
- Port: Port SQL server listens on (different for different SQL vendors)
UserName: -> SQL login name
Password: -> SQL password
[control] Driver = /usr/local/lib/psqlodbcw.so Port = 5432 ServerName = localhost Database = control UserName = ccc Password = support
- Create database now using following command
# createdb databasename
- Create table command
# createtb --help ( to see option) # createtb -d <databasename>
- Log off all Control users
Set flag in cooad.
Enable update of odbc data file = Y
Now this flag will start loging in dblog.dat.- If the sql database is not used from the begining of control, all files will not be logged in dblog.dat to update in sql database. So simple enabling flag will not logged old files of control to dblog.dat, only the new files will be logged. To update old and as well as old , use this command.
# fdb2log
- Use
# dblogdump
command to check contents of dblog.dat - Now to start dumping control data to sql database. use this command
# log2odbc --help
# log2odbc -d <ODBC_Connection_Name>
- To test to see if the data dumping is successful.
# psql dannydb postgresql => select * from stock;
If you see the data you are looking for, then it is working. log2odbc defaults has the following default values:
ODBC Connection Name = control Username = ccc Password = support
You will need to alter the /u/cc/binl/incremental_dump script so that log2odbc accesses the correct DB
Now after everything is done, place a job in ccc's crontab to do perform the automatic update.
* * * * * /u/cc/binl/incremental_dump >> /u/cc/LOG/incremental_dump.log 2>&1
dblog.dat does not get re-initialised. You will need to run rolldblog to initialise dblog.dat
Maybe add to backup script
