安裝完gitlab后的運(yùn)維操作
初次配置服務(wù)
sudo gitlab-ctl reconfigure
啟動(dòng)服務(wù)
sudo gitlab-ctl start
停止服務(wù)
sudo gitlab-ctl stop
重啟服務(wù)
sudo gitlab-ctl restart
檢查服務(wù)的日志信息
檢查redis的日志
sudo gitlab-ctl tail redis
檢查postgresql的日志
sudo gitlab-ctl tail postgresql
檢查gitlab-workhorse的日志
sudo gitlab-ctl tail gitlab-workhorse
檢查logrotate的日志
sudo gitlab-ctl tail logrotate
檢查nginx的日志
sudo gitlab-ctl tail nginx
檢查sidekiq的日志
sudo gitlab-ctl tail sidekiq
檢查unicorn的日志
sudo gitlab-ctl tail unicorn
檢查服務(wù)狀態(tài)
sudo gitlab-ctl status
一般服務(wù)狀態(tài)顯示信息
顯示格式:
狀態(tài) : 進(jìn)程名稱:(進(jìn)程ID)運(yùn)行時(shí)間(秒);進(jìn)程的日志服務(wù)進(jìn)程和運(yùn)行時(shí)間
run: gitlab-workhorse: (pid 4752) 10759s; run: log: (pid 1077) 13185s
run: logrotate: (pid 12616) 3557s; run: log: (pid 1079) 13185s
run: nginx: (pid 4764) 10758s; run: log: (pid 1076) 13185s
run: postgresql: (pid 4770) 10757s; run: log: (pid 1073) 13185s
run: redis: (pid 4778) 10757s; run: log: (pid 1072) 13185s
run: sidekiq: (pid 4782) 10756s; run: log: (pid 1075) 13185s
run: unicorn: (pid 4786) 10756s; run: log: (pid 1074) 13185s
狀態(tài) 說(shuō)明
run 運(yùn)行狀態(tài)
down 服務(wù)停止
常見(jiàn)的問(wèn)題
頁(yè)面顯示500溉贿,Whoops, something went wrong on our end.
500
Whoops, something went wrong on our end.
Try refreshing the page, or going back and attempting the action again.
Please contact your GitLab administrator if this problem persists.
如何檢查和定位問(wèn)題?
使用命令檢查所有服務(wù)的狀態(tài)
sudo gitlab-ctl status
檢查服務(wù)狀態(tài)如下
run: gitlab-workhorse: (pid 4752) 10862s; run: log: (pid 1077) 13288s
run: logrotate: (pid 16553) 59s; run: log: (pid 1079) 13288s
run: nginx: (pid 4764) 10861s; run: log: (pid 1076) 13288s
run: postgresql: (pid 4770) 10860s; run: log: (pid 1073) 13288s
run: redis: (pid 4778) 10860s; run: log: (pid 1072) 13288s
run: sidekiq: (pid 4782) 10859s; run: log: (pid 1075) 13288s
run: unicorn: (pid 4786) 10859s; run: log: (pid 1074) 13288s
定位問(wèn)題
從服務(wù)狀態(tài)信息中顯示數(shù)據(jù)庫(kù)postgresql的狀態(tài)是down,即服務(wù)停止解恰。
檢查數(shù)據(jù)庫(kù)postgresql的運(yùn)行日志银室,檢查出現(xiàn)什么錯(cuò)誤枕面?
$ sudo gitlab-ctl tail postgresql
==> /var/log/gitlab/postgresql/state <==
==> /var/log/gitlab/postgresql/current <==
2017-12-21_02:49:51.42192 FATAL: terminating connection due to administrator command
2017-12-21_02:49:51.42194 FATAL: terminating connection due to administrator command
2017-12-21_02:49:51.42194 LOG: autovacuum launcher shutting down
2017-12-21_02:49:51.42287 FATAL: terminating connection due to administrator command
2017-12-21_02:49:51.42289 FATAL: terminating connection due to administrator command
2017-12-21_02:49:51.42463 LOG: shutting down
2017-12-21_02:49:51.59345 LOG: database system is shut down
2017-12-21_02:50:43.38811 LOG: database system was shut down at 2017-12-21 02:49:51 GMT
2017-12-21_02:50:43.41991 LOG: database system is ready to accept connections
2017-12-21_02:50:43.42055 LOG: autovacuum launcher started
日志顯示,數(shù)據(jù)庫(kù)的訪問(wèn)權(quán)限應(yīng)該是只有用戶本身有讀寫(xiě)執(zhí)行的權(quán)限政钟,用戶組和其他用戶不能有權(quán)限路克。
修改數(shù)據(jù)庫(kù)數(shù)據(jù)的權(quán)限后,檢查服務(wù)運(yùn)行正常养交。
了解了問(wèn)題的定位和解決方式精算,其他問(wèn)題也很容易在日志中發(fā)現(xiàn)和解決,問(wèn)題可能是磁盤(pán)空間少碎连,用戶權(quán)限錯(cuò)誤或者其他原因灰羽。
gitlab管理員密碼忘記,怎么重置密碼
Gitlab 修改root用戶密碼
使用rails工具打開(kāi)終端
sudo gitlab-rails console production
查詢用戶的email,用戶名廉嚼,密碼等信息玫镐,id:1 表示root賬號(hào)
user = User.where(id: 1).first
重新設(shè)置密碼
user.password = ‘新密碼‘
user.password_confirmation = ‘新密碼‘
保存密碼
user.save!
完整的操作ruby腳本
user = User.where(id: 1).first
user.password = ‘新密碼‘
user.password_confirmation = ‘新密碼‘
user.save!
然后使用重置過(guò)的密碼重新登錄。
git 客戶端下載地址:https://git-scm.com/download/win
Linux有關(guān)的可以直接yum 安裝或者apt-get 安裝
Centos: yum install git
Ubuntu: apt-get install git