Use Linux Systemd to start palo server

    Use Linux Systemd to start palo server

    Hi,

    I'd like to share some work I did recently to get palo server to start automatically on boot using linux's systemd. Systemd has been in-use in fedora/RHEL for a while, but is now also being adopted by debian/ubuntu.

    Although systemd is generic, folder locations vary betwen linux distrubtions. I'm working with Fedora 21, so I referred to the Filesystem Hierarchical Standard (FHS) located on:
    docs.fedoraproject.org/en-US/F…de/s1-filesystem-fhs.html
    And decided on the following folder locations
    /etc -> configuration file like palo.ini
    /usr/bin -> palo executable file palo
    /usr/lib64 -> server .so files like libhttps.palo.so.5.1
    /var/log -> log files = palo.log
    /var/lib/palo/Data -> Data folder

    Having build the server earlier from source into ~/palo/code/molap/server/build_5.1, I copied the files to the above folder locations using the following commands:

    Source Code

    1. sudo cp ~/palo/code/molap/server/build_5.1/usr/bin/palo /usr/bin
    2. sudo cp ~/palo/code/molap/server/build_5.1/usr/lib64/libhttps.palo.so.5.1.4 /usr/lib64
    3. cd /usr/lib64
    4. sudo ln -s libhttps.palo.so.5.1.4 libhttps.palo.so
    5. sudo ln -s libhttps.palo.so.5.1.4 libhttps.palo.so.0
    6. cd /var/lib
    7. sudo mkdir palo
    8. sudo cd palo
    9. sudo mkdir Data


    That leaves the palo.ini file and the palo.sevice files. First the palo.ini. I used the attached palo.ini file which I believe is pretty standard. I created the palo.ini file by pasting the contents into vi, but you could can create it using nano or gedit:

    Source Code

    1. cd /etc
    2. sudo vi palo.ini

    <i, paste, esc, shift-ZZ>

    Finally the palo.service file. This is the file that defines how systemd will manage the palo server. I've attached the palo.serice file which I created. It's fairly self explanatory. The most important line is:
    ExecStart=/usr/bin/palo --init-file /etc/palo.ini --data-directory /var/lib/palo/Data
    Which defines how the palo server will be invoked. Since the data directory parameter is also present in the palo.ini file, ideally it would be possible to leave off the --data-directory parameter and thus allow the data directory to be configured via the palo.ini file. Unfortunatly leaving off the --data-directory parameter seems to prevent the palo server starting, so for the moment note that the palo.service file is definining the data location and not palo.ini.

    Source Code

    1. cd /usr/lib/systemd/system
    2. sudo vi palo.service

    <i, paste, esc, shift-ZZ>

    All done in terms of the setup. You can test out the configuration immediately by using

    Source Code

    1. sudo systemctl daemon-reload
    2. sudo systemctl start palo

    Which should give you a palo server running in the background. Finally, to automatically start on boot enter:

    Source Code

    1. sudo systemctl enable palo

    You should now be able to restart the computer and have the palo server started automatically.

    If it want to stop the palo server for what-ever reason:

    Source Code

    1. sudo systemctl stop palo

    To disable the service from starting at boot-time:

    Source Code

    1. sudo systemctl disable palo


    Thanks and regards
    Michael