eth2.0 : lighthouse + Prometheus 安装并自启动

lighthouse

1、文档地址

https://lighthouse-book.sigmaprime.io/installation-binaries.html

2、安装

$ cd ~

$ curl -LO https://github.com/sigp/lighthouse/releases/download/v2.5.1/lighthouse-v2.5.1-x86_64-unknown-linux-gnu.tar.gz


-------------------------
解压

$ tar xvf lighthouse-v2.5.1-x86_64-unknown-linux-gnu.tar.gz


-------------------------
启动--bn + 导入验证器

$ /usr/local/bin/lighthouse  bn  --network goerli account validator import --directory $HOME/staking-deposit-cli/validator_keys --datadir /var/lib/lighthouse

也可以单独使用

$ /usr/local/bin/lighthouse  bn  --network goerli


--directory : 验证器位置
--datadir   : 导入后文件位置,可以不写, 默认在 /root/.lighthouse


-------------------------
启动--vc
$ /usr/local/bin/lighthouse  vc --network goerli   --datadir /var/lib/lighthouse

--datadir   : 导入后文件位置,可以不写, 默认在 /root/.lighthouse 和上面的bn位置对应

Prometheuse

1、下载地址

https://prometheus.io/download/

2、安装

$ cd ~

$ curl -LO https://github.com/prometheus/prometheus/releases/download/v2.37.0/prometheus-2.37.0.linux-amd64.tar.gz


下载完成后解压到 user/local/bin

$ tar xvf prometheus-2.37.0.linux-amd64.tar.gz

$ sudo cp prometheus-2.37.0.linux-amd64/prometheus /usr/local/bin/

$ sudo cp prometheus-2.37.0.linux-amd64/promtool /usr/local/bin/

移动

$ sudo cp -r prometheus-2.37.0.linux-amd64/consoles /etc/prometheus

$ sudo cp -r prometheus-2.37.0.linux-amd64/console_libraries /etc/prometheus

3、配置文件

$ sudo vim /etc/prometheus/prometheus.yml

可以修改,如果你只有geth钱包,就只写
   - job_name: geth
 
------------------------------------------------------

global:
  scrape_interval: 15s
scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets:
          - localhost:9090
  - job_name: node_exporter
    static_configs:
      - targets:
          - localhost:9100
  - job_name: lighthouse-bn
    metrics_path: /metrics
    static_configs:
      - targets:
          - localhost:5052
  - job_name: besu
    metrics_path: /metrics
    static_configs:
      - targets:
          - localhost:9545
  - job_name: erigon
    metrics_path: /debug/metrics/prometheus
    static_configs:
      - targets:
          - localhost:6060
  - job_name: geth
    metrics_path: /debug/metrics/prometheus
    static_configs:
      - targets:
          - localhost:6060
  - job_name: nethermind
    static_configs:
      - targets:
          - localhost:9091

4、配置权限

$ sudo vim /etc/systemd/system/prometheus.service
--------------------------------------------------------------------------
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=root---这里如果自己配置权限组的话就修改
Group=root
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/var/lib/prometheus \
  --web.console.templates=/etc/prometheus/consoles \
  --web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target


--------------------------------------------------------------------------

启动
$ sudo systemctl daemon-reload

$ sudo systemctl start prometheus

$ sudo systemctl status prometheus

--------------------------------------------------------------------------
服务自启动-------

$ sudo systemctl enable prometheus

Prometheuse Node Exporter

1、git 地址

https://github.com/prometheus/node_exporter

2、安装

$ cd ~

$ curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz

--------------------------------------------------------------------------
解压

$ tar xvf node_exporter-1.3.1.linux-amd64.tar.gz

$ sudo cp node_exporter-1.3.1.linux-amd64/node_exporter /usr/local/bin

--------------------------------------------------------------------------

3、配置文件

配置service 服务

$ sudo vim /etc/systemd/system/node_exporter.service
--------------------------------------------------------------------------
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=root ---这里可以配置组,不想用root的话
Group=root
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target

--------------------------------------------------------------------------
启动
$ sudo systemctl daemon-reload
$ sudo systemctl start node_exporter
$ sudo systemctl status node_exporter

使用日志输出检查错误
$ sudo journalctl -fu node_exporter

配置自启动
$ sudo systemctl enable node_exporter


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

行人已

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值