]> git.sur5r.net Git - bacula/docs/blob - docs/manuals/fr/main/sqlite.tex
Setup fr/console
[bacula/docs] / docs / manuals / fr / main / sqlite.tex
1 %%
2 %%
3
4 \chapter{Installing and Configuring SQLite}
5 \label{SqlLiteChapter}
6 \index[general]{Installing and Configuring SQLite }
7 \index[general]{SQLite!Installing and Configuring }
8
9 Please note that SQLite both versions 2 and 3 are not network enabled,
10 which means that they must be linked into the Director rather than accessed
11 by the network as MySQL and PostgreSQL are. This has two consequences:
12 \begin{enumerate}
13 \item SQLite cannot be used in the {\bf bweb} web GUI package.
14 \item If you use SQLite, and your Storage daemon is not on the same
15 machine as your Director, you will need to transfer your database
16 to the Storage daemon's machine before you can use any of the SD tools
17 such as {\bf bscan}, ...
18 \end{enumerate}
19
20 \section{Installing and Configuring SQLite -- Phase I}
21 \index[general]{Phase I!Installing and Configuring SQLite -- }
22 \index[general]{Installing and Configuring SQLite -- Phase I }
23
24 If you use the {\bf ./configure \verb:--:with-sqlite} statement for configuring {\bf
25 Bacula}, you will need SQLite version 2.8.16 or later installed. Our standard
26 location (for the moment) for SQLite is in the dependency package {\bf
27 depkgs/sqlite-2.8.16}. Please note that the version will be updated as new
28 versions are available and tested. 
29
30 Installing and Configuring is quite easy. 
31
32 \begin{enumerate}
33 \item Download the Bacula dependency packages  
34 \item Detar it with something like:
35
36    {\bf tar xvfz depkgs.tar.gz}  
37
38    Note, the above command requires GNU tar. If you do not  have GNU tar, a
39    command such as:
40
41    {\bf zcat depkgs.tar.gz | tar xvf -}
42
43    will probably accomplish the same thing. 
44
45 \item {\bf cd depkgs}
46
47 \item {\bf make sqlite}  
48
49 \end{enumerate}
50
51
52 Please note that the {\bf ./configure} used to build {\bf Bacula} will need to
53 include {\bf \verb:--:with-sqlite} or {\bf \verb:--:with-sqlite3} depending
54 one which version of SQLite you are using. You should not use the {\bf
55 \verb:--:enable-batch-insert} configuration parameter for Bacula if you
56 are using SQLite version 2 as it is probably not thread safe.  If you
57 are using SQLite version 3, you may use the {\bf \verb:--:enable-batch-insert} 
58 configuration option with Bacula, but when building SQLite3 you MUST
59 configure it with {\bf \verb:--:enable-threadsafe} and 
60 {\bf \verb:--:enable-cross-thread-connections}.
61
62 By default, SQLite3 is now run with {\bf PRAGMA synchronous=OFF} this
63 increases the speed by more than 30 time, but it also increases the 
64 possibility of a corrupted database if your server crashes (power failure
65 or kernel bug).  If you want more security, you can change the PRAGMA
66 that is used in the file src/version.h.
67
68
69 At this point, you should return to completing the installation of {\bf
70 Bacula}. 
71
72
73 \section{Installing and Configuring SQLite -- Phase II}
74 \label{phase2}
75 \index[general]{Phase II!Installing and Configuring SQLite -- }
76 \index[general]{Installing and Configuring SQLite -- Phase II }
77
78 This phase is done {\bf after} you have run the {\bf ./configure} command to
79 configure {\bf Bacula}. 
80
81 {\bf Bacula} will install scripts for manipulating the database (create,
82 delete, make tables etc) into the main installation directory. These files
83 will be of the form *\_bacula\_* (e.g. create\_bacula\_database). These files
84 are also available in the \lt{}bacula-src\gt{}/src/cats directory after
85 running ./configure. If you inspect create\_bacula\_database, you will see
86 that it calls create\_sqlite\_database. The *\_bacula\_* files are provided
87 for convenience. It doesn't matter what database you have chosen;
88 create\_bacula\_database will always create your database. 
89
90 At this point, you can create the SQLite database and tables: 
91
92 \begin{enumerate}
93 \item cd \lt{}install-directory\gt{}
94
95    This directory contains the Bacula catalog  interface routines.  
96
97 \item ./make\_sqlite\_tables
98
99    This script creates the SQLite database as well as the  tables used by {\bf
100    Bacula}. This script will be  automatically setup by the {\bf ./configure}
101    program  to create a database named {\bf bacula.db} in {\bf Bacula's}  working
102    directory. 
103 \end{enumerate}
104
105 \section{Linking Bacula with SQLite}
106 \index[general]{SQLite!Linking Bacula with }
107 \index[general]{Linking Bacula with SQLite }
108
109 If you have followed the above steps, this will all happen automatically and
110 the SQLite libraries will be linked into {\bf Bacula}. 
111
112 \section{Testing SQLite}
113 \index[general]{SQLite!Testing }
114 \index[general]{Testing SQLite }
115
116 We have much less "production" experience using SQLite than using MySQL.
117 SQLite has performed flawlessly for us in all our testing.  However,
118 several users have reported corrupted databases while using SQLite.  For
119 that reason, we do not recommend it for production use.
120
121 If Bacula crashes with the following type of error when it is started:
122 \footnotesize
123 \begin{verbatim}
124 Using default Catalog name=MyCatalog DB=bacula
125 Could not open database "bacula".
126 sqlite.c:151 Unable to open Database=/var/lib/bacula/bacula.db.
127 ERR=malformed database schema - unable to open a temporary database file
128 for storing temporary tables
129 \end{verbatim}
130 \normalsize
131
132 this is most likely caused by the fact that some versions of
133 SQLite attempt to create a temporary file in the current directory.
134 If that fails, because Bacula does not have write permission on
135 the current directory, then you may get this errr.  The solution is
136 to start Bacula in a current directory where it has write permission.
137
138
139 \section{Re-initializing the Catalog Database}
140 \index[general]{Database!Re-initializing the Catalog }
141 \index[general]{Re-initializing the Catalog Database }
142
143 After you have done some initial testing with {\bf Bacula}, you will probably
144 want to re-initialize the catalog database and throw away all the test Jobs
145 that you ran. To do so, you can do the following: 
146
147 \footnotesize
148 \begin{verbatim}
149   cd <install-directory>
150   ./drop_sqlite_tables
151   ./make_sqlite_tables
152 \end{verbatim}
153 \normalsize
154
155 Please note that all information in the database will be lost and you will be
156 starting from scratch. If you have written on any Volumes, you must write an
157 end of file mark on the volume so that Bacula can reuse it. Do so with: 
158
159 \footnotesize
160 \begin{verbatim}
161    (stop Bacula or unmount the drive)
162    mt -f /dev/nst0 rewind
163    mt -f /dev/nst0 weof
164 \end{verbatim}
165 \normalsize
166
167 Where you should replace {\bf /dev/nst0} with the appropriate tape drive
168 device name for your machine.