過了一個國慶,同僚反映說seafile服務挂掉了,無法正常連接配接。
剛才解決了一下,把相關問題簡要記錄一下:
1.首先連接配接阿裡雲,獲得相關IP位址(如果已知IP位址,則不需要該步驟)
2.通過xshell或者其他ssh工具連接配接上去(此類工具很多,比如putty、secureCRT、MobaXterm Personal Edition等)
3.首次檢視seafile程序是否正常: ps -ef | grep seafile ;
4.嘗試啟動seafile服務,并監控和檢查相關log,看是否正常:
報錯資訊如下:
$ ./seafile.sh start
SQLException: Failed to start connection pool -- Access denied for user 'root'@'localhost' (using password: YES)
raised in ConnectionPool_start at src/db/ConnectionPool.c:287
failed to run "ccnet-server -t"
5.在上面這一步報錯,則相應需要解決該問題。
下面是一些解決步驟:
(1)檢視相關log位置:vi /home/haochuang/Seafile/logs/seafile.log,更多log:
[root@AY140714154144069b22Z ~]# ls -la /home/tuyou/Seafile/logs
total 6236
drwxr-xr-x 2 root root 4096 Oct 10 15:06 .
drwxrwxr-x 8 haochuang haochuang 4096 Oct 10 11:03 ..
-rw-r--r-- 1 root root 213261 Oct 10 15:07 ccnet.log
-rw-r--r-- 1 root root 24055 Oct 10 15:06 controller.log
-rw-r--r-- 1 root root 222309 Oct 10 15:06 seafile.log
-rw-r--r-- 1 root root 5892209 Oct 10 10:50 seahub_django_request.log
-rw-r--r-- 1 root root 0 May 13 14:00 seahub.log
(2)檢查磁盤空間是否足夠:df -lh
(3)檢視目前已經啟動的seafile服務,通過 pgrep 指令 來檢查 seafile/seahub 的程序是否在運作:
徹底殺掉相關服務,要強行殺死 seafile/seahub 程序,把上面的 pgrep 換成 pkill 指令即可:
重新開機seafile:
(4)檢查相關musql配置情況,并直接手動連接配接;
(5)重置mysql資料庫賬号密碼,由于該機器上面我當時配置了seafile和redmine,端口分别為 3306 和 3307,擔心會有影響的話,可以備份部分關鍵檔案:
發現我的mysql連接配接時候報錯資訊如下:
Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'問題的解決
查了一下,發現這種問題需要強行重新修改密碼,方法如下:
/etc/init.d/mysqld stop (service mysqld stop )
/usr/bin/mysqld_safe --skip-grant-tables
另外開個SSH連接配接
[root@localhost ~]# mysql
mysql>use mysql
mysql>update user set password=password("123456") where user="root";
mysql>flush privileges;
mysql>exit
(6)修改完成之後再次重新開機seafile,發現基本正常了。
(7)其他補充資訊:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
關于該問題,在解決過程中,看到網上的朋友說有多種解決辦法:
Red Hat Enterprise Linux 5伺服器上mysql啟動報錯:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
原因1-啟動指令錯誤:
我開始的時候直接輸入指令:mysql start
正确的啟動指令是:
/etc/rc.d/init.d/mysql start
原因2-配置檔案錯誤:
檢查etc下面的my.cnf如下内容:
[client]
#password = your_password
port = 3306
socket = /usr/mysql-data/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
原因3-啟動檔案錯誤:
需要修改MySQL啟動腳本/etc/rc.d/init.d/mysql,
其中datadir= ? 一行檢查下!
原因4-前提是你在使用php連接配接時候報錯!
在/etc/php.ini修改mysql.default_socket的值設定為:
mysql.default_socket=/var/lib/mysql/mysql.sock
回到終點設定個連接配接:ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
(在/etc/php.ini中mysql.default_socket這個檔案中,關于mysql.default_socket的值的說明是這樣的,
;Default socket name for local MySQL connects. If empty, uses the built-in MySQL defaults.
這個值一開始是空的,也就是說,如果我們不主動去修改的話,php将會使用内建在mysql中的預設值)
另一篇文章:
Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'問題的解決
這種問題需要強行重新修改密碼,方法如下:
pkill -KILL -t pts/0 可将pts為0的**使用者(之前運作mysqld_safe的使用者視窗)強制踢出
正常啟動 MySQL:/etc/init.d/mysqld start (service mysqld start)
注意:另外還遇到需要service mysql star才能啟動service mysql stop才能停止。
還有直接使用mysql不能找到指令,錯誤為“bash: mysql: command not found”可以直接**mysql的安裝目錄中的bin檔案夾跟絕對路徑運作指令,還有的需要加./mysql 才能執行。
......
總之,其實很多問題乍一看,被蒙住了,但是隻要靜下心看一下,耐心去解決,其實很多問題并不是問題。
本文轉自 念槐聚 部落格園部落格,原文連結:http://www.cnblogs.com/haochuang/p/4867356.html,如需轉載請自行聯系原作者