Bacula-users

Re: [Bacula-users] [END OF THREAD]Re: Can't run bacula any more.

2017-03-18 09:20:42
Subject: Re: [Bacula-users] [END OF THREAD]Re: Can't run bacula any more.
From: Kern Sibbald <kern AT sibbald DOT com>
To: "Erik P. Olsen" <epodata AT gmail DOT com>, bacula-users AT lists.sourceforge DOT net
Date: Sat, 18 Mar 2017 14:19:45 +0100
Hello,

I would make only one note to the procedure below: if your Director and 
the MySQL database are on the same machine, it is probably more 
efficient to use the default installation that uses the Unix socket.

Best regards,

Kern


On 03/18/2017 09:10 AM, Erik P. Olsen wrote:
> On 2017-03-18 at 04:11:19 Josip Deanovic wrote:
>
>> On Friday 2017-03-17 21:32:13 Erik P. Olsen wrote:
>>> Hello everybody,
>>>
>>> I would like to express my gratitude to all you nice guys who so
>>> patiently have provided many good advice. I really do appreciate your
>>> effort. However, no matter have good these advice were I have not been
>>> able to get bacula going on this system. I do believe that I have
>>> issued all necessary commands and scripts more than once and that they
>>> should work. The problem lies probably in either mariadb or the
>>> database files which probably are corrupt.
>>>
>>> I have not given up but I will concentrate on getting mariadb correctly
>>> installed and see if this approach will be profitable.
>>
>> I will try to recap the whole mysql story you might miss since
>> you said that you do not have any previous database experience.
>>
>> - mysql default port is 3306
>> - mysql can listen on the localhost (in mysql terminology that would
>>    mean unix socket), 127.0.0.1 or any other IP (be it ipv4 or ipv6)
>>    which is setup in the mysql main configuration file
>> - for mysql localhost and 127.0.0.1 IS NOT THE SAME THING
>> - one can setup some root password for mysql root user (very good idea)
>>    but for the purposes of testing the setup it is not necessary
>> - if the password for the mysql root user is set one should always
>>    either use -p option (when connection as mysql root user to the mysql
>>    server) on the command line to instruct the mysql client tool that it
>>    needs to prompt for a mysql root password or as an alternative a
>>    file /root/.my.cnf should be created that looks like:
>>    [client]
>>    # use either localhost or 127.0.0.1 depending on how your mysql
>>    # server is being configured in the main mysql configuration file
>>    host=localhost
>>    user=root
>>    password="some_very_strong_password"
>> - at this point no matter whether the mysql root password is set or
>>    not, system root user will always be able to connect to the mysql
>>    server using simple mysql command
>> - one can use "netstat -lnp | grep 3306" to determine if the
>>    mysql server is listening on some IP or just on the unix socket
>> - only if mysql server has been configured to listen on 127.0.0.1
>>    one can use the option "-h 127.0.0.1" to connect to the mysql
>>    server using mysql client tool.
>> - mysql server contains mysql database which contains several tables
>>    needed for its normal operation
>> - once connected to the mysql server as mysql root user, one can
>>    use the command "show database" to list the available databases,
>>    the command "use <some database>" to enter the specified database,
>>    the command "show tables" to list the tables in the database we
>>    have entered and so on
>> - mysql database contains two very important tables (among others):
>>    user
>>    db
>> - the SQL command "select * from mysql.user" would list the whole
>>    content of the "user" table in the mysql database and it can be
>>    used to determine if the target user exist and from what hosts
>>    it should be able to connect
>> - pretty much the same goes for the mysql.db table
>> - at this point it would be the best if the both, localhost and
>>    127.0.0.1 are allowed to connect to the server and to the target
>>    database (in our case most probably "bacula")
>> - in mysql if the table in the mysql has been changed manually using
>>    SQL commands, a command "flush privileges;" has to be issued in
>>    order for mysql to apply the changes (some mysql commands also
>>    require flushing privileges), alternatively a mysql server can
>>    be restarted
>>
>>
>> So, when setting up the mysql database for use with mysql the
>> path would be:
>>
>> 1. install the mysql
>> 2. set up the root password and flush privileges or restart the
>>     mysql server (lame)
>> 3. configure the mysql as you see fit, chose the port and the
>>     IP/socket it is going to bind/listen and restart the mysql
>>     server
>> 4. set up the /root/.my.cnf file in accordance to the configuration
>>     options you have used in step 3.
>> 5. make sure your firewall will not block your mysql connections
>> 6. test mysql connections manually using commands:
>>     mysql -h localhost -u root -p
>>     (of course, if you have used 127.0.0.1 you will use that instead
>>     of localhost)
>> 7. if successful in step 6 we can go to the directory containing
>>     files:
>>       create_mysql_database
>>       make_mysql_tables
>>       grant_mysql_privileges
>>     and as a system root user execute them in that order
>> 8. if successful in step 7, set some strong password for the
>>     bacula user (similarly to the changing password of the mysql
>>     root user) and do the "flush privileges;" as mysql root user or
>>     restart the mysql server
>> 9. test the connection manually (in this example I am using mysql
>>     user "bacula" and the database "bacula" while -p means that
>>     mysql client tool should prompt for the password):
>>     mysql -h localhost -u bacula -p bacula
>> 10. if successful in step 9, setup the catalog database connection
>>     in the bacula-dir.conf like:
>>     dbname = "bacula"; dbuser = "bacula"; dbpassword = "some_strong_pass";
>> dbaddress = "localhost"
>>     note that the dbaddress should reflect your mysql setup (so if it's
>>     configured to bind to 127.0.0.1, use 127.0.0.1, if it's something
>>     else, use something else
>> 11. test the bacula-dir configuration using the command:
>>    bacula-dir -t
>> 12. restart the bacula-dir and check if it's running using the command:
>>    ps aux | grep bacula-dir
>> 13. connect to the bacula-dir using your bconsole tool
>> 14. if step 13 failes, check everything, check system logs, check bacula
>>     logs, check mysql logs, do the connection tests one more time, debug...
>>
>>
>> It's pretty strait forward (this is not a sarcasm).
>>
>> If you are using hostnames instead of IPs then you should make sure
>> that
>> - mysql has been setup to support that
>> - that the host resolves to the IP you believe it should
>>
>> For the purpose of debugging it would be a good idea to turn off
>> everything that could stand in the way, e.g. firewall, selinux.
>>
>>
>   
> Thanks a lot.
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users