[MXS-302] Allow maxscale startup configuration to be controlled on rpms via /etc/sysconfig/maxscale Created: 2015-08-10  Updated: 2017-12-01  Resolved: 2015-10-04

Status: Closed
Project: MariaDB MaxScale
Component/s: Packaging
Affects Version/s: 1.2.1
Fix Version/s: 1.3.0

Type: New Feature Priority: Minor
Reporter: Simon J Mudd Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MXS-70 Allow configuring modules dynamically... Closed

 Description   

Please add a component: packaging
Note: please add a version 1.2.0 as this issue affects maxscale-1.2.0-x86_64-rhel6.rpm.

I want to use syslog to log maxscale behaviour. To do so requires changing the maxscale startup. When using rpm packaging you provide no facility to override the default startup option which is:

daemon --pidfile $MAXSCALE_PIDFILE /usr/bin/maxscale --user=maxscale >& /dev/null

So option settings described here https://mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale/maxscale-administration-tutorial/ can not be set.

Suggestion: add a patch with something like this:

$ diff -u /etc/init.d/maxscale.ORIG /etc/init.d/maxscale
— /etc/init.d/maxscale.ORIG 2015-08-10 13:31:58.000000000 +0200
+++ /etc/init.d/maxscale 2015-08-10 13:26:29.000000000 +0200
@@ -43,6 +43,9 @@

  1. Source function library.
    . /etc/rc.d/init.d/functions

+# Source networking configuration.
+[ -f /etc/sysconfig/maxscale ] && . /etc/sysconfig/maxscale
+

  1. we can rearrange this easily
    processname=maxscale
    servicename=maxscale
    @@ -55,7 +58,7 @@
    CHECK_RET=$?
    [ $CHECK_RET -eq 0 ] && echo -n " found $my_check" && success && CHECK_RET=0
  • daemon --pidfile $MAXSCALE_PIDFILE /usr/bin/maxscale --user=maxscale >& /dev/null
    + daemon --pidfile $MAXSCALE_PIDFILE /usr/bin/maxscale $MAXSCALE_OPTIONS --user=maxscale >& /dev/null

RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename

Provide a default /etc/sysconfig/maxscale file which would be empty:

  1. maxscale startup options
    #

In my case I'll be using something like this:

  1. maxscale startup options
    MAXSCALE_OPTIONS="--syslog=yes --maxscalelog=no"

and then make sure in the rpm configuration that if this file is changed by a DBA/sysadmin that it's not overwritten using something like:

%attr(0644, root, root) %config(noreplace) /etc/sysconfig/maxscale

This change avoids me having to change each rpm's /etc/init.d/maxscale (as it won't behave the way I need), and probably also help others with similar requirements (special configs) while not affecting the default user.



 Comments   
Comment by Simon J Mudd [ 2015-08-10 ]

JIRA seems to have munged my patch a bit. I hope it is clear.

Comment by markus makela [ 2015-08-10 ]

There is work already in progress which enables controlling the logging mechanism through the maxscale.cnf file on the MXS-70 branch on github. You can see the documentation for the new options here.

Comment by Simon J Mudd [ 2015-08-11 ]

This is not just about logging. I've been trying to use the standard /etc/init.d/maxscale init script and finding that with some binaries built to use different directories I needed to be able to modify the options passed to /usr/bin/maxscale on startup. So please don't dismiss this as a logging issue only.

To give you an idea I currently have my "patched" /etc/init.d/maxscale setup to read from /etc/sysconfig/maxscale which has the following content:

# maxscale startup options
MAXSCALE_OPTIONS="--syslog=yes --maxscalelog=no --libdir=/usr/lib64/maxscale --logdir=/var/log/maxscale --datadir=/var/lib/maxscale/data --piddir=/var/run/maxscale"

This is only because I built maxscale with the wrong paths but the point is if I wanted to use different locations then this seems like a convenient way to do that.

Sometimes people will want to use this mechanism and other times using /etc/maxscale.cnf (you mention logging but other startup options make sense in /etc/maxscale.cnf too[1]).

[1] or you set the maxscale.cnf path and then allow that to configure all options. Give us the freedom to choose what makes most sense. Note: if you add this flexibility it would be convenient to make startup logging show clearly which values are being used for these settings.

Comment by markus makela [ 2015-08-11 ]

The ongoing work has added all the values controllable via command line also to be via the configuration file.

Here is a small example of the new funcionality. Here all the values (except of course the configuration file location) are defined via the configuration file.

[maxscale]
threads=4
libdir=/home/markus/build/lib64/maxscale
logdir=/home/markus/build/
datadir=/home/markus/build/
cachedir=/home/markus/build/
language=/home/markus/build/lib/maxscale/
piddir=/home/markus/build/

Comment by Simon J Mudd [ 2015-08-11 ]

Hi Markus,

Good news. Is the trailing "/" required, optional or best left out ?
You seem to show both options so it's not clear to me which style of setting is "preferred" or "best".

Comment by markus makela [ 2015-08-12 ]

The trailing slash is optional since all of the options are interpreted as directories.

Comment by Dipti Joshi (Inactive) [ 2015-08-18 ]

markus makela Since you are following this Issue, assigned it to you. Can you please add link to the issue whose fix in develop branch is addressing what Simon is asking here ?

Thanks,
Dipti

Comment by Simon J Mudd [ 2015-09-18 ]

See also: https://github.com/mariadb-corporation/MaxScale/pull/92

Generated at Thu Feb 08 03:58:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.