ntwk-calibration install-services ゝ一纸荒年。 2023-03-06 05:50 1阅读 0赞 ### ntwk-calibration install-services 安装服务 ### * 1,~~编译服务\`install-services\`~~ * 2,~~设置环境变量~~ * 3,查看区块链链同步 * 4,初始化矿工 * 5,矿工环境变量 * 6,ntwk-calibration-8.13.1 # 1,编译服务`install-services` # * `cat lotus/Makefile` make install-services * 安装服务 # make install-services install -C ./lotus /usr/local/bin/lotus install -C ./lotus-miner /usr/local/bin/lotus-miner install -C ./lotus-worker /usr/local/bin/lotus-worker mkdir -p /usr/local/lib/systemd/system mkdir -p /var/log/lotus install -C -m 0644 ./scripts/lotus-daemon.service /usr/local/lib/systemd/system/lotus-daemon.service install -C -m 0644 ./scripts/lotus-miner.service /usr/local/lib/systemd/system/lotus-miner.service systemctl daemon-reload lotus-daemon and lotus-miner services installed. Don't forget to 'systemctl enable lotus-daemon|lotus-miner' for it to be enabled on startup. * 设置开机启动 # systemctl enable lotus-daemon # systemctl enable lotus-miner * 运行`lotus`守护进程 # systemctl start lotus-daemon.service * 查看日志 # tail -f /var/log/lotus/daemon.log # 2,设置环境变量 # # ls /usr/local/lib/systemd/system/ lotus-daemon.service lotus-miner.service * 查看服务 # cat lotus-daemon.service [Unit] Description=Lotus Daemon After=network-online.target Requires=network-online.target [Service] Environment=GOLOG_FILE="/var/log/lotus/daemon.log" Environment=GOLOG_LOG_FMT="json" ExecStart=/usr/local/bin/lotus daemon Restart=always RestartSec=10 MemoryAccounting=true MemoryHigh=8G MemoryMax=10G LimitNOFILE=8192:10240 [Install] WantedBy=multi-user.target * 添加环境变量 systemctl edit lotus-daemon.service vim /etc/systemd/system/lotus-daemon.service.d/override.conf [Service] Environment="FIL_PROOFS_PARAMETER_CACHE=/storage/v27" Environment="LOTUS_PATH=/storage/lotuswork/lotus" Environment="LOTUS_STORAGE_PATH=/storage/lotuswork/lotusstorage" Environment="WORKER_PATH=/storage/lotuswork/lotusworker" Environment="TMPDIR=/storage/lotuswork/tmpdir" Environment="FIL_PROOFS_PARENT_CACHE=/storage/lotuswork/filecoin-parents" Environment="IPFS_GATEWAY=https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/" Environment="FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1" Environment="FIL_PROOFS_USE_GPU_TREE_BUILDER=1" Environment="FIL_PROOFS_MAXIMIZE_CACHING=1" Environment="RUST_BACKTRACE=full" Environment="RUST_LOG=debug" * 不使用GPU,使用CPU Environment="BELLMAN_NO_GPU=1" Environment="BELLMAN_VERIFIER=cpu" * 重载配置 systemctl daemon-reload systemctl start lotus-daemon.service # 3,查看区块链链同步 # lotus sync wait # 4,初始化矿工 # lotus-miner init --owner=钱包地址 --sector-size=32GiB # 5,矿工环境变量 # systemctl edit lotus-miner.service * 设置一样的环境变量 vim /etc/systemd/system/lotus-miner.service.d/override.conf systemctl daemon-reload systemctl start lotus-miner.service # 6,ntwk-calibration-8.13.1 # # export ALL_PROXY=socks5://127.0.0.1:1080 # git config --global http.proxy 'socks5://127.0.0.1:1080' # go env GOPROXY # go env GO111MODULE # go env -w GOPROXY=https://goproxy.cn,direct # go env -w GO111MODULE=on git clone --branch ntwk-calibration https://github.com/filecoin-project/lotus.git env RUSTFLAGS="-C target-cpu=native -g" FFI_BUILD_FROM_SOURCE=1 make clean all lotus-bench * 或者 env RUSTFLAGS="-C target-cpu=native -g" FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1 FIL_PROOFS_USE_GPU_TREE_BUILDER=1 FFI_BUILD_FROM_SOURCE=1 make clean all lotus-bench make install make lotus-shed lotus-chainwatch make install-all-services # systemctl enable lotus-daemon # systemctl enable lotus-miner # systemctl enable lotus-chainwatch -------------------- 参考: 1. [如何在systemd服务中设置环境变量? ][systemd_] [systemd_]: https://qastack.cn/server/413397/how-to-set-environment-variable-in-systemd-service
还没有评论,来说两句吧...