05) Setting Up Database

Setting Up the database for storing parsed data of bounceHammer

After bounceHammer has been installed into /usr/local/bouncehammer successfully, Next, set up the database for storing parsed data created by bounceHammer. If you use bin/mailboxparser command (Parsing) and bin/logger command (Accumulating) ONLY, No database is needed.

Parameters in this description

In this description, We use MySQL 5.1 or PostgreSQL 8.4.4 on the host 127.0.0.1, database name is bouncehammer, database username is bouncehammer ( same as db name), database password is 794-uguisu-heiankyo.

Use MySQL

Please create an empty database and a user on the database previously. The database host can be located anywhere in the network. If the database exists on the host that bounceHammer is running, You can use UNIX Domain socket to connect to the database.

# /usr/local/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1537
Server version: 5.1.44 Source distribution
...
mysql> CREATE DATABASE bouncehammer;
Query OK, 1 row affected (0.01 sec)
 
mysql> GRANT ALL PRIVILEGES ON bouncehammer.* TO bouncehammer@127.0.0.1 IDENTIFIED BY '794-uguisu-heiankyo';
Query OK, 0 rows affected (0.04 sec)
 
mysql> FLUSH PRIVILEGES;

Use PostgreSQL

Operation is the same as the previous paragraph(MySQL), Please create an empty database and a user on the database previously. The database host can be located anywhere in the network. If the database exists on the host that bounceHammer is running, You can use UNIX Domain socket to connect to the database.

# su - postgres
$ cd /usr/local/pgsql
$ ./bin/createuser bouncehammer
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y
 
$ ./bin/createdb -Obouncehammer bouncehammer
$ ./bin/psql
psql (8.4.4)
Type "help" for help.
 
postgres=# ALTER USER bouncehammer password ' 794-uguisu-heiankyo'; ⏎ ALTER ROLE

Create database tables

After you have created the empty database and the database user, Next, Create database tables which are used by bounceHammer. SQL script files located in /usr/local/bouncehammer/share/script are useful to create database tables.

# cd /usr/local/bouncehammer/share/script
 
If you selected MySQL
# cat ./MySQL*.sql | /usr/local/mysql/bin/mysql -ubouncehammer -Dbouncehammer -h127.0.0.1 -p
Enter password: 794-uguisu-heiankyo
 
Insert records into each master table
# cat ./mastertable-* | /usr/local/mysql/bin/mysql -ubouncehammer -Dbouncehammer -h127.0.0.1 -p
Enter password: 794-uguisu-heiankyo
 
 
If you selected PostgreSQL
# cat ./PostgreSQL*.sql | /usr/local/pgsq/bin/psql -Ubouncehammer -dbouncehammer
...
Insert records into each master tabl
# cat ./mastertable-* | /usr/local/pgsq/bin/psql -Ubouncehammer -dbouncehammer

If you need example records in the database, please insert records saved in the script /usr/local/bouncehammer/share/script/records-example.sql into the database.
After you have set up the database, proceed to Main configuration file bouncehammer.cf page.

No TrackBacks

TrackBack URL: http://bouncehammer.jp/cgi-bin/mt/mt-tb.cgi/118

Leave a comment