LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-01-2016, 02:46 AM   #1
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Rep: Reputation: 4
Unhappy systemd dependency issue?


Hello everyone

I am running owncloud on CentOS 7. Everything is working perfectly except one. When I reboot server in owncloud I have error:
app":"cron","message":"Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '

In: /usr/lib/systemd/system

httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.service mariadb.service remote-fs.target nss-lookup.target

mariadb.service
[Unit]
Description=MariaDB database server
After=syslog.target
After=network.service

I have configured start services in this manner, it solved problem but after several reboot owncloud still logs same error.

My question, does that happen because of delay of mysql creates socket after httpd service is starting or it is not related with service dependencies?

Thank you
 
Old 02-01-2016, 02:28 PM   #2
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 159

Rep: Reputation: 35
Hi

I run Owncloud on CentOS7 using mariadb as well.
I do not completely get your problem.

So if you reboot your server, owncloud fails to start?

And if you manually start owncloud after it first failed it would run?

You fixed it by changing your systemd files and this worked but stopped working.

Were new versions of owncloud or apache or mariadb installed?
 
Old 02-01-2016, 02:31 PM   #3
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
yes when server is rebooted owncloud logs that: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '

when i stop all services and then I start first mariadb and than apache everything works fine.

Apache/2.4.6
mysql Ver 15.1 Distrib 5.5.44-MariaDB


thanks
 
Old 02-01-2016, 02:32 PM   #4
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 159

Rep: Reputation: 35
Did the systemd file change?
 
Old 02-01-2016, 02:34 PM   #5
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
sorry dont understand, systemd what?
 
Old 02-01-2016, 02:36 PM   #6
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
i have changed

httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.service mariadb.service remote-fs.target nss-lookup.target

mariadb.service
[Unit]
Description=MariaDB database server
After=syslog.target
After=network.service

reloaded daemons and that's all.
 
Old 02-01-2016, 02:54 PM   #7
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 159

Rep: Reputation: 35
You list output for the files httpd.service and
mariadb.service in /usr/lib/systemd/system.
Do the files still contain what you showed in your first post? Or have they changed because of an update?
 
Old 02-01-2016, 02:58 PM   #8
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
cant list them right now but yes they contain them now
 
Old 02-02-2016, 07:45 AM   #9
paul2015
Member
 
Registered: Apr 2015
Distribution: CentOS Fedora
Posts: 149

Original Poster
Rep: Reputation: 4
sorry guys for late reply. here are service files under /usr/lib/systemd/system and logfiles.

apache
========================================================================================
[Unit]
Description=The Apache HTTP Server
After=network.service mariadb.service remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target
========================================================================================

mariadb
========================================================================================
[Unit]
Description=MariaDB database server
After=syslog.target
After=network.service

[Service]
Type=simple
User=mysql
Group=mysql

ExecStartPre=/usr/libexec/mariadb-prepare-db-dir n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=/usr/bin/mysqld_safe --basedir=/usr
ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Place temp files in a secure directory, not /tmp
PrivateTmp=true

# I have added
LimitNOFILE=infinity
LimitMEMLOCK=infinity

[Install]
WantedBy=multi-user.target
========================================================================================

my.cnf
========================================================================================
bind-address = localhost
ft_min_word_len = 3

user = mysql
port = 3306

default_storage_engine = InnoDB
socket = /var/lib/mysql/mysql.sock
pid_file = /var/lib/mysql/mysql.pid

datadir = /var/lib/mysql

innodb_buffer_pool_size = 1024M
innodb_file_per_table=1
innodb_flush_method = O_DIRECT


key_buffer_size = 64M

log_error = /var/lib/mysql/mysql-error.log
slow_query_log = 1
slow_query_log_file = /var/lib/mysql/mysql-slow.log

tmp_table_size = 32M
max_heap_table_size = 32M
query_cache_type = 0
query_cache_size = 00
max_connections = 300
thread_cache_size = 50
table_open_cache = 800
open_files_limit = 65535

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d
========================================================================================

mysql-slow.log
========================================================================================
/usr/libexec/mysqld, Version: 5.5.44-MariaDB-log (MariaDB Server). started with:
Tcp port: 3306 Unix socket: /var/lib/mysql/mysql.sock
and again that error:
========================================================================================

no errors in mysql-error.log
========================================================================================

mariadb.log
========================================================================================
[Note] /usr/libexec/mysqld: Normal shutdown
[Note] Event Scheduler: Purging the queue. 0 events
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 6468534974
[Note] /usr/libexec/mysqld: Shutdown complete
mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB-log) starting as process 3061 ...
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.7
InnoDB: Using Linux native AIO
InnoDB: Initializing buffer pool, size = 1.0G
InnoDB: Completed initialization of buffer pool
InnoDB: highest supported file format is Barracuda.
InnoDB: Waiting for the background threads to start
Percona XtraDB (http://www.percona.com) 5.5.43-MariaDB-37.2 started; log sequence number 6468534974
[Note] Plugin 'FEEDBACK' is disabled.
[Note] Server socket created on IP: '127.0.0.1'.
[Note] Event Scheduler: Loaded 0 events
[Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.44-MariaDB-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
========================================================================================

Owncloud.log
{"reqId":"dswK\/N49mSbawKvu\/UQV","remoteAddr":"","app":"cron","message":"Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '\/var\/lib\/mysql\/mysql.sock' (2)","level":4,"time":"2016-02-02_00:45:03"}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [LFS SVN only] systemd-udev-208 and kmod-15 build issue ReaperX7 Linux From Scratch 2 12-14-2013 07:17 PM
Dependency Issue carlosinfl Red Hat 2 04-09-2009 10:04 AM
massive dependency issue natv Linux - Software 3 08-12-2007 12:51 PM
Firefox Dependency issue? synth42 Slackware 4 03-17-2006 05:25 AM
rpm dependency issue afrodocter Linux - Software 1 04-15-2004 03:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration