Setup Accounting Database

From JonDonym Wiki
(Difference between revisions)
Jump to: navigation, search
Line 2: Line 2:
 
<iimg>[[Setup Accounting Database]]![[Image:en.png]]</iimg><iimg>[[Setup der Accounting Datenbank]]![[Image:de.png]]</iimg>
 
<iimg>[[Setup Accounting Database]]![[Image:en.png]]</iimg><iimg>[[Setup der Accounting Datenbank]]![[Image:de.png]]</iimg>
 
== Setup Accounting Database ==
 
== Setup Accounting Database ==
If you run pay Mixes, you moreover have to initialise the postgres database. It is only needed for the first Mix. However, you do not know if you may not switch position some time, and therefore also other Mixes should do that.  
+
If you run payment mixes you have to initialize the Postgres database additionally. It is only needed for the first mix but you do not know if you may not switch the position some time and therefore other mixes should do that as well.  
  
 
First switch to user postgres.
 
First switch to user postgres.
Line 11: Line 11:
 
  createdb -O aiuser aidb</code>
 
  createdb -O aiuser aidb</code>
  
Login into the database environment as user ''postgres'', set the password for ''aiuser'' and leave the database environment.
+
Log into the database environment as user ''postgres'', set the password for ''aiuser'' and leave the database environment.
 
  <code>psql -d aidb
 
  <code>psql -d aidb
 
  alter user aiuser with password 'PASSWORD';
 
  alter user aiuser with password 'PASSWORD';
 
  \q</code>
 
  \q</code>
  
Edit the postgres configuration file ''pg_hba.conf'' located somewhere in ''/etc/postgresql'' and allow connections with password. Replace the commands there that enforce ident or md5 login. Note that Postgres looks only for the first line matching a connection type, so don't insert several lines for the same connection type.  
+
Edit the Postgres configuration file ''pg_hba.conf'' located somewhere in ''/etc/postgresql'' and allow connections with password. There, replace the commands that enforce ident or md5 login. Note that Postgres looks only for the first line matching a connection type, thus don't insert several lines for the same connection type.  
 
  <code># All other connections by UNIX sockets
 
  <code># All other connections by UNIX sockets
 
  local all all password
 
  local all all password
Line 22: Line 22:
 
  host all all 127.0.0.1 255.255.255.255 ident passwordş</code>
 
  host all all 127.0.0.1 255.255.255.255 ident passwordş</code>
  
Restart postgres after configuration changes:
+
Restart Postgres after configuration changes:
 
  <code>/etc/init.d/postgresql restart</code>
 
  <code>/etc/init.d/postgresql restart</code>
  
Line 28: Line 28:
 
  <code>psql -U aiuser -d aidb < /home/mix/stable/mixtables.sql</code>
 
  <code>psql -U aiuser -d aidb < /home/mix/stable/mixtables.sql</code>
  
Login as ''aiuser'' with your password and check if you see the created tables or not... If you do, everything is OK!
+
Log in as ''aiuser'' with your password and check if you see the created tables or not... If you do, everything is OK!
 
  <code>psql -U aiuser -d aidb  
 
  <code>psql -U aiuser -d aidb  
 
  \dt
 
  \dt
 
  \q </code>
 
  \q </code>

Revision as of 22:03, 23 March 2010

File:En.png File:De.png

Setup Accounting Database

If you run payment mixes you have to initialize the Postgres database additionally. It is only needed for the first mix but you do not know if you may not switch the position some time and therefore other mixes should do that as well.

First switch to user postgres.

su postgres

Afterwards create the new user aiuser and the accounting database.

createuser -A -D aiuser
createdb -O aiuser aidb

Log into the database environment as user postgres, set the password for aiuser and leave the database environment.

psql -d aidb
alter user aiuser with password 'PASSWORD';
\q

Edit the Postgres configuration file pg_hba.conf located somewhere in /etc/postgresql and allow connections with password. There, replace the commands that enforce ident or md5 login. Note that Postgres looks only for the first line matching a connection type, thus don't insert several lines for the same connection type.

# All other connections by UNIX sockets
local all all password
# All IPv4 connections from localhost
host all all 127.0.0.1 255.255.255.255 ident passwordş

Restart Postgres after configuration changes:

/etc/init.d/postgresql restart

Fill the accounting database with the accounting tables. The mix source tree contains the SQL file mixtables.sql with all instructions.

psql -U aiuser -d aidb < /home/mix/stable/mixtables.sql

Log in as aiuser with your password and check if you see the created tables or not... If you do, everything is OK!

psql -U aiuser -d aidb 
\dt
\q 
Personal tools