Gitlab磁盘空间问题 针对Prometheus

Gitlab磁盘空间不够后,会导致git使用出现异常。一般网上搜索到的是针对gitlab的data配置进行转移,但是还有一种情况是prometheus的data也会占用一定的磁盘空间。我遇到的正是因为prometheus导致的磁盘空间不足。

linux(CentOS 6.5)下

1、先查看磁盘空间大小。确定是prometheus占用空间

du -h --max-depth=1 /var/opt/gitlab/

2、修改gitlab中prometheus配置  vi /etc/gitlab/gitlab.rb

################################################################################
## Prometheus
##! Docs: https://docs.gitlab.com/ee/administration/monitoring/prometheus/
################################################################################

###! **To enable only Monitoring service in this machine, uncomment
###!   the line below.**
###! Docs: https://docs.gitlab.com/ee/administration/high_availability
# monitoring_role['enable'] = true

# prometheus['enable'] = true
# prometheus['monitor_kubernetes'] = true
# prometheus['username'] = 'gitlab-prometheus'
# prometheus['group'] = 'gitlab-prometheus'
# prometheus['uid'] = nil
# prometheus['gid'] = nil
# prometheus['shell'] = '/bin/sh'
# prometheus['home'] = '/var/opt/gitlab/prometheus'
# prometheus['log_directory'] = '/var/log/gitlab/prometheus'
# prometheus['rules_files'] = ['/var/opt/gitlab/prometheus/rules/*.rules']
# prometheus['scrape_interval'] = 15
# prometheus['scrape_timeout'] = 15
# prometheus['env_directory'] = '/opt/gitlab/etc/prometheus/env'
# prometheus['env'] = {
#   'SSL_CERT_DIR' => "/opt/gitlab/embedded/ssl/certs/"
# }
#
### Custom Prometheus flags
#
# prometheus['flags'] = {
#   'storage.tsdb.path' => "/var/opt/gitlab/prometheus/data",
#   'storage.tsdb.retention.time' => "15d",
#   'config.file' => "/var/opt/gitlab/prometheus/prometheus.yml"
# }
 

找到如上配置项,有3个办法,1)关掉prometheus 。这个是系统监控收集信息的工具。prometheus_monitoring['enable'] = false

2)修改data路径,改为磁盘空间更大的路径。 'storage.tsdb.path' => "/var/opt/gitlab/prometheus/data"

3)修改data保存时间。改小天数prometheus会自动清除过期的data。  'storage.tsdb.retention.time' => "15d"

 

3、保存配置修改,重启gitlab

gitlab-ctl stop

gitlab-ctl reconfigure

 gitlab-ctl start

你可能感兴趣的:(开发)