[MXS-800] Config file needs full path Created: 2016-07-10  Updated: 2016-12-02  Resolved: 2016-12-02

Status: Closed
Project: MariaDB MaxScale
Component/s: Core, Documentation
Affects Version/s: 1.4.3
Fix Version/s: 2.0.2

Type: Bug Priority: Minor
Reporter: Will Fong Assignee: Esa Korhonen
Resolution: Fixed Votes: 0
Labels: None

Sub-Tasks:
Key
Summary
Type
Status
Assignee
MXS-802 Log current working directory in daem... Sub-Task Closed markus makela  
Sprint: 2016-23

 Description   

Some confusing behavior when specifying a configuration file when running on the command line:

wfong@willcn:~$ ls -la maxscale.cnf 
-rw-rw-r-- 1 wfong wfong 520 Jul 10 09:50 maxscale.cnf
wfong@willcn:~$ maxscale -f maxscale.cnf 
*
* Error : Failed to open, read or process the MaxScale configuration file. Exiting. See the error log for details.     
*
wfong@willcn:~$ tail -n7 /var/log/syslog
Jul 10 10:28:35 willcn maxscale[30733]: Configuration file: maxscale.cnf
Jul 10 10:28:35 willcn maxscale[30733]: Log directory: /tmp
Jul 10 10:28:35 willcn maxscale[30733]: Data directory: /home/wfong/maxscale
Jul 10 10:28:35 willcn maxscale[30733]: Module directory: /usr/lib/x86_64-linux-gnu/maxscale
Jul 10 10:28:35 willcn maxscale[30733]: Service cache: /tmp/maxscale_cache
Jul 10 10:28:35 willcn maxscale[30733]: Failed to open file 'maxscale.cnf': No such file or directory
Jul 10 10:28:35 willcn maxscale[30733]: Failed to open, read or process the MaxScale configuration file maxscale.cnf. Exiting.
wfong@willcn:~$ maxscale -f ./maxscale.cnf 
*
* Error : Failed to open, read or process the MaxScale configuration file. Exiting. See the error log for details.     
*
wfong@willcn:~$ tail -n7 /var/log/syslog
Jul 10 10:29:38 willcn maxscale[30747]: Configuration file: ./maxscale.cnf
Jul 10 10:29:38 willcn maxscale[30747]: Log directory: /tmp
Jul 10 10:29:38 willcn maxscale[30747]: Data directory: /home/wfong/maxscale
Jul 10 10:29:38 willcn maxscale[30747]: Module directory: /usr/lib/x86_64-linux-gnu/maxscale
Jul 10 10:29:38 willcn maxscale[30747]: Service cache: /tmp/maxscale_cache
Jul 10 10:29:38 willcn maxscale[30747]: Failed to open file './maxscale.cnf': No such file or directory
Jul 10 10:29:38 willcn maxscale[30747]: Failed to open, read or process the MaxScale configuration file ./maxscale.cnf. Exiting.
wfong@willcn:~$ maxscale -f foo.bar
* Opening file /var/log/maxscale/maxscale1.log failed due 13, Permission denied.
Error : opening logfile /var/log/maxscale/maxscale1.log failed.
Error : opening log file /var/log/maxscale/maxscale1.log failed. Exiting MaxScale
*
* Error : Initializing log manager failed.
*
*
* Error : Failed to expand config file name to complete path. Error : No such file or directory 
*
2016-07-10 10:29:59   error  : Error : Failed to expand config file name to complete path. Error : No such file or directory
wfong@willcn:~$ maxscale -f /home/wfong/maxscale.cnf 
wfong@willcn:~$ ps aux|grep maxscale
wfong    30771  2.0  0.6 564864 54656 ?        Ssl  10:32   0:00 maxscale -f /home/wfong/maxscale.cnf
wfong    30781  0.0  0.0  15968   948 pts/19   S+   10:32   0:00 grep --color=auto maxscale
wfong@willcn:~$ maxscale --version
MaxScale 1.4.3
wfong@willcn:~$ 

The documentation and the error message should mention that the complete path must be specified. It would also be good if the error message specified the locations that is has checked (save an admin some time).

Alternatively, it would be great if a relative position (like just `maxscale -f myfile.cnf`) would be possible as well.

Thanks!
-w



 Comments   
Comment by markus makela [ 2016-07-11 ]

I think this might be a problem with the fact that MaxScale changes the working directory in daemon mode to the log directory (/var/log/maxscale by default). If you add the -d switch, it will use the current working directory without forking the process.

The path to the configuration file could be resolved relative to the directory where MaxScale was started from instead of using the actual working directory. This way relative pathnames could be used even without the -d switch.

In any case, the changing of the working directory should be documented somewhere.

Generated at Thu Feb 08 04:02:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.