ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Configuring a Monitoring node for Scaling and High Availability > 原文:[https://docs.gitlab.com/ee/administration/high_availability/monitoring_node.html](https://docs.gitlab.com/ee/administration/high_availability/monitoring_node.html) * [Standalone Monitoring node using Omnibus GitLab](#standalone-monitoring-node-using-omnibus-gitlab) * [Migrating to Service Discovery](#migrating-to-service-discovery) # Configuring a Monitoring node for Scaling and High Availability[](#configuring-a-monitoring-node-for-scaling-and-high-availability "Permalink") 在 GitLab 12.0 中[引入](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/3786) . 您可以配置 Prometheus 节点以监视 GitLab. ## Standalone Monitoring node using Omnibus GitLab[](#standalone-monitoring-node-using-omnibus-gitlab "Permalink") Omnibus GitLab 软件包可用于配置运行[Prometheus](../monitoring/prometheus/index.html)和[Grafana](../monitoring/performance/grafana_configuration.html)的独立 Monitoring 节点. 监视节点不是高度可用. 请参阅[缩放和高可用性](../reference_architectures/index.html)的 GitLab 扩展和高可用性选项的概述. 以下步骤是使用 Omnibus 配置运行 Prometheus 和 Grafana 的 Monitoring 节点的最低必需步骤: 1. SSH 进入"监视"节点. 2. 从 GitLab 下载页面使用**步骤 1 和 2** [下载/安装](https://about.gitlab.com/install/)所需的 Omnibus GitLab 软件包. * 不要完成下载页面上的任何其他步骤. 3. [`CONSUL_SERVER_NODES`](../postgresql/replication_and_failover.html#consul-information) ,请确保收集[`CONSUL_SERVER_NODES`](../postgresql/replication_and_failover.html#consul-information) ,它们是 Consul 服务器节点的 IP 地址或 DNS 记录. 请注意,它们显示为`YYYY consul1.gitlab.example.com ZZZZ` 4. 编辑`/etc/gitlab/gitlab.rb`并添加内容: ``` external_url 'http://gitlab.example.com' # Enable Prometheus prometheus['enable'] = true prometheus['listen_address'] = '0.0.0.0:9090' prometheus['monitor_kubernetes'] = false # Enable Login form grafana['disable_login_form'] = false # Enable Grafana grafana['enable'] = true grafana['admin_password'] = 'toomanysecrets' # Enable service discovery for Prometheus consul['enable'] = true consul['monitoring_service_discovery'] = true # Replace placeholders # Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z # with the addresses of the Consul server nodes consul['configuration'] = { retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z), } # Disable all other services gitlab_rails['auto_migrate'] = false alertmanager['enable'] = false gitaly['enable'] = false gitlab_exporter['enable'] = false gitlab_workhorse['enable'] = false nginx['enable'] = true postgres_exporter['enable'] = false postgresql['enable'] = false redis['enable'] = false redis_exporter['enable'] = false sidekiq['enable'] = false puma['enable'] = false node_exporter['enable'] = false gitlab_exporter['enable'] = false ``` 5. 运行`sudo gitlab-ctl reconfigure`来编译配置. 下一步是告诉所有其他节点监视节点在哪里: 1. 编辑`/etc/gitlab/gitlab.rb` ,然后添加或查找并取消注释以下行: ``` gitlab_rails['prometheus_address'] = '10.0.0.1:9090' ``` 其中`10.0.0.1:9090`是 Prometheus 节点的 IP 地址和端口. 2. 保存文件并[重新配置 GitLab,](../restart_gitlab.html#omnibus-gitlab-reconfigure)以使更改生效. ## Migrating to Service Discovery[](#migrating-to-service-discovery "Permalink") 使用`consul['monitoring_service_discovery'] = true`启用使用服务发现进行`consul['monitoring_service_discovery'] = true` ,请确保未在`/etc/gitlab/gitlab.rb`设置`prometheus['scrape_configs']` . 在`/etc/gitlab/gitlab.rb`同时设置`consul['monitoring_service_discovery'] = true`和`prometheus['scrape_configs']`都会导致错误.