]> git.sur5r.net Git - bacula/docs/blobdiff - docs/manuals/en/main/postgresql.tex
Add note for script rights
[bacula/docs] / docs / manuals / en / main / postgresql.tex
index f688ff17268db26efec4c9761258fc71ff06a4bd..b2ff89c8efee01b5a7a8cffe121256fa92aae78e 100644 (file)
@@ -98,6 +98,14 @@ directory or PostgreSQL is installed in a default location, you do not need to
 specify the directory). This is needed so that Bacula can find the necessary
 include headers and library files for interfacing to PostgreSQL. 
 
+An important thing to note here is that {\bf Bacula} makes two connections
+to the PostgreSQL server for each backup job that is currently running.  If
+you are intending to run a large number of concurrent jobs, check the value
+of {\bf max\_connections} in your PostgreSQL configuration file to ensure
+that it is larger than the setting {\bf Maximum Concurrent Jobs}
+in your director configuration.  {\bf Setting this too low will result in
+some backup jobs failing to run correctly!}
+
 {\bf Bacula} will install scripts for manipulating the database (create,
 delete, make tables etc) into the main installation directory. These files
 will be of the form *\_bacula\_* (e.g. create\_bacula\_database). These files
@@ -116,23 +124,10 @@ user).
 \begin{enumerate}
 \item cd \lt{}install-directory\gt{}
 
-   This directory contains the Bacula catalog  interface routines.  
-
-\item ./create\_bacula\_database
+   This directory contains the Bacula catalog interface routines.  
 
-   This script creates the PostgreSQL {\bf bacula} database.  
-   Before running this command, you should carefully think about
-   what encoding sequence you want for the text fields (paths, files, ...).
-   Ideally, the encoding should be set to UTF8. However, many Unix systems
-   have filenames that are not encoded in UTF8, either because you have
-   not set UTF8 as your default character set or because you have imported
-   files from elsewhere (e.g. MacOS X).  For this reason, Bacula uses
-   SQL\_ASCII as the default encoding.  If you want to change this,
-   please modify the script before running it, but be forewarned that
-   Bacula backups will fail if PostgreSQL finds any non-UTF8 sequences.
-
-   If running the script fails, it is probably because the database is
-   owned by a user other than yourself.  On many systems, the database
+\item Create the database owner ({\bf bacula})
+   On many systems, the PostreSQL master 
    owner is {\bf pgsql} and on others such as Red Hat and Fedora it is {\bf
    postgres}.  You can find out which it is by examining your /etc/passwd
    file.  To create a new user under either your name or with say the name
@@ -142,15 +137,33 @@ user).
    su
    (enter root password)
    su pgsql (or postgres)
-   createuser kern (or perhaps bacula)
+   createuser bacula
    Shall the new user be allowed to create databases? (y/n) y
    Shall the new user be allowed to create more new users? (y/n) (choose
          what you want)
    exit
 \end{verbatim}
-    
-    At this point, you should be able to execute the
-    ./create\_bacula\_database command.
+   Normally the {\bf bacula} user must be able to create new databases,
+   if you use the script in the next item, 
+   or you will have to create one for it, but it does not need to 
+   create new users.
+
+\item ./create\_bacula\_database
+
+   This script creates the PostgreSQL {\bf bacula} database.  
+   Before running this command, you should carefully think about
+   what encoding sequence you want for the text fields (paths, files, ...).
+   We strongly recommend that you use the default value of SQL\_ASCII
+   that is in the create\_bacula\_database script.  Please be warned
+   that if you change this value, your backups may fail.  After running
+   the script, you can check with the command:
+
+\begin{verbatim}
+   psql -l
+\end{verbatim}
+
+   and the column marked {\bf Encoding} should be {\bf SQL\_ASCII} for
+   all your Bacula databases (normally {\bf bacula}).
 
 \item ./make\_bacula\_tables
 
@@ -179,8 +192,9 @@ PostgreSQL-directory/bin/psql --command \\dp bacula
 \normalsize
 
 Also, I had an authorization problem with the password. In the end,
-I had to modify my {\bf pg\_hba.conf} file (in /var/lib/pgsql/data on my machine)
-from:
+I had to modify my {\bf pg\_hba.conf} file (in /var/lib/pgsql/data on my machine
+in /var/lib/postgresql/8.x on others, and in /etc/postgres/8.x/main on
+still others -- what a mess!) from:
 
 \footnotesize
 \begin{verbatim}
@@ -196,7 +210,7 @@ my regression scripts without having a password.
 
 A more secure way to perform database authentication is with md5
 password hashes.  Begin by editing the {\bf pg\_hba.conf} file, and
-just prior the the existing ``local'' and ``host'' lines, add the line:
+above the existing ``local'' and ``host'' lines, add the line:
 
 \footnotesize
 \begin{verbatim}
@@ -204,14 +218,14 @@ just prior the the existing ``local'' and ``host'' lines, add the line:
 \end{verbatim}
 \normalsize
 
-and restart the Postgres database server (frequently, this can be done
+then restart the Postgres database server (frequently, this can be done
 using "/etc/init.d/postgresql restart" or "service postgresql restart") to
 put this new authentication rule into effect.
 
 Next, become the Postgres administrator, postgres, either by logging
 on as the postgres user, or by using su to become root and then using
-su - postgres to become postgres.  Add a password to the bacula
-database for the bacula user using:
+{\bf su - postgres} or {\bf su - pgsql} to become postgres.  
+Add a password to the {\bf bacula} database for the {\bf bacula} user using:
 
 \footnotesize
 \begin{verbatim}
@@ -301,8 +315,8 @@ device name for your machine.
 \index[general]{Installing PostgreSQL from RPMs}
 If you are installing PostgreSQL from RPMs, you will need to install
 both the PostgreSQL binaries and the client libraries.  The client
-libraries are usually found in a devel package, so you must
-install:
+libraries are usually found in a {\bf devel} or {\bf dev} package, so you must
+install the following for rpms:
 
 \footnotesize
 \begin{verbatim}
@@ -313,6 +327,21 @@ install:
 \end{verbatim}
 \normalsize
 
+
+and the following for debs:
+
+\footnotesize
+\begin{verbatim}
+  postgresql
+  postgresql-common
+  postgresql-client
+  postgresql-client-common
+  libpq5
+  libpq-dev
+\end{verbatim}
+\normalsize
+
+
 These will be similar with most other package managers too.  After
 installing from rpms, you will still need to run the scripts that set up
 the database and create the tables as described above.
@@ -359,7 +388,8 @@ before proceeding with this process!
 \item Start PostgreSQL on your system.  
 \item Create a bacula user in Postgres with the createuser command.  Depending on
    your Postgres install, you may have to SU to the  user who has privileges to
-   create a user.  
+   create a user, you can also have to change permissions on catalog scripts
+   to fit your situation.  
 \item Verify your pg\_hba.conf file contains sufficient permissions to  allow
    bacula to access the server. Mine has the following since  it's on a secure
    network:  
@@ -370,8 +400,7 @@ local all all trust
                 
 host all all 127.0.0.1 255.255.255.255 trust
                 
-NOTE: you should restart your postgres server if you
-      made changes
+NOTE: you should reload (or restart) your postgres server if you  made changes
       
 \end{verbatim}
 \normalsize