Cleaning the FAZZT Database on Linux

KenCast Clean Database.png

Hi GEONETCasters,

In order to clean the FAZZT database on Linux (thus liberating lots of space on the Hard Drive), please follow the procedure below:

Note: This procedure consider the POSTGRESQL version 9.4. Please check which version you have installed and changed the commands appropriately.

As root, stop the FAZZT service:

service fazzt stop

Enter the following command to enter the fazzt database:

service postgresql-9.4 start
psql -h localhost -U fazzt fazzt

When entering the database, you’ll see the text “fazzt=>“, indicating that you may enter the commands.

These are the four commands you should use:

fazzt=> delete from receivedfiles;
fazzt=> delete from transmissions;
fazzt=> vacuum full receivedfiles;
fazzt=> vacuum full transmissions;
fazzt-> \q

Note: The “delete” commands will take a while to be accomplished, depending on the amount of received files you have. In the oterh hand, the “vacuum” commands will finish fast.

Clena FAZZT db

As root, start the FAZZT service:

service fazzt start

— IN CASE YOUR FAZZT DATABASE GET CORRUPTED–

If, for some reason, your postgresql database get corrupted and the FAZZT client can’t connect to it, reset it with the following procedure:

1-) As root, stop the FAZZT service:

service fazzt stop

2-) Start the postgresql service:

# service postgresql-9.4 start

3-) Remove your “fazzt” database and your “fazzt” user:

# su - postgres
# dropdb fazzt
# dropuser fazzt

4-) Quit the database:

$ exit

5-) Stop the postgresql service:

# service postgresql-9.4 stop

6-) Remove your postgresql data folder:

# rm -rf /var/lib/pgsql/9.4/data/

7-) Reconfigure your database with the procedure below:

– Configure the database for the initialization:

# service postgresql-9.4 initdb

–  Start the database:

# service postgresql-9.4 start

– Configure the database to start automatically:

# chkconfig postgresql-9.4 on
# chkconfig --level 345 postgresql-9.4 on

– Restart the database:

# service postgresql-9.4 restart

– Edit the file “postgresql.conf” file found at /var/lib/pgsql/9.4/data:

# gedit /var/lib/pgsql/9.4/data/postgresql.conf

…Changing the following line on session “CONNECTIONS AND AUTENTICATION” (line 54 more or less):

listen_addresses = '*' #What IP address (es) to listen on;

– At the same session, four lines below, remove the comments “#”, if they exist:

port 5432
max_connections = 100

– In the same file, further down, in the ** AUTOVACUUM PARAMETERS ** session (line 463 more os less), remove the comment “#”, and change it to “off”

autovacuum = off # Enable autovacuum subprocess? 'on'

– Save and close the “postgresql.conf” file.

– Edit the “pg_hba.conf” file found at gedit /var/lib/pgsql/9.4/data/

# gedit /var/lib/pgsql/9.4/data/pg_hba.conf

 …Changing the following lines at the end of the file from peer or ident to “trust”:

# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident

– Also, add the following line in the end of the same session:

# host all all 0.0.0.0/0 trust

– This is what you should have

# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident
host all all 0.0.0.0/0 trust

trust

– Save and close the “pg_hba.conf” file.

 – Change the memory limit used by the database, editing the “limits.conf” file found at gedit /etc/security/

# gedit /etc/security/limits.conf

 …Adding the following lines before the “End of file”

fazzt soft nofile 4096
fazzt hard nofile 4096
# End of file

– Restart the PostgreSQL:

# service postgresql-9.4 restart

– Enter the PostgreSQL:

su - postgres

– Create the “fazzt” database:

$ createdb fazzt
$ createuser -s -d -r -l -P fazzt

– You will be asked for inserting a new password for the database. It may be the same as the root. However, you may use any password you want. Insert the chosen password twice (e.g.: fazzt and fazzt).

Enter password for new role: fazzt
Enter it again: fazzt

 – Quit the Postgresql:

$ exit

 – Restart Postgresql:

# service postgresql-9.4 restart

 – Return to the database and verify the created account:

# su - postgres
$ psql -h localhost -U fazzt fazzt

– The output of the previous command should be:

Type “help” for help
fazzt=#

 – Quit the Database with the “\q” command:

postgres=# \q
$ exit

Your FAZZT Database was successfully reset!

5-) RESET your FAZZT Client:

# service fazzt reset

6-) Reconfigure your FAZZT Client according to the procedure below. Wait for the channels to reappear.

KENCAST FAZZT CONFIGURATION

 – Let’s configure the FAZZT Client for the GNC-A ingestion. The configuration is the same for versions 8.1 or 9.0. At the menu on the left, choose “Configuration” -> “Channels” and then, at the “Channels” window, choose “Channels Defaults”. At “Interface”, choose the IP address of the Network Card where you have your DVB-S receiver connected. Click on “Save”.

KCa.png

– Select the ingestion folder at “Configurations”“Storage Settings”“Virtual Paths: View/Edit”

KCb.png

– Click at the backslash \” as shown on the image below and choose the folder where the received files will be stored. In this procedure we suggested “/data/fazzt” but it may be any folder you want.

KCc.png

– Back to the “Channels” interface, click at the “1.Main” channel:

KCd.png

– And at “Interface”, choose “default”:

KCe.png

– After a while (a couple of minutes), you should see the GNC-A Broadcast channels being listed at the “Configuration”“Channels” interface.

KCf.png

Please check our other posts about GNC-A Ingestion Hardware / Software: