- Installation according to the Avalanche Baremetal Archive Node guide:
Avalanche Baremetal Archive Node by Stake🦑Squid
It is important to pay attention to the configuration of the service file during installation, and to create a path and specify it with the chain C.
mkdir - p /root/avalanchego/configs/chains/C
- My service file in the final version looks like this:
[Unit]
Description=Avalanche Node
Documentation=https://docs.avax.network/nodes/maintain/avalanchego-config-flags
After=network.target
[Service]
User=root
WorkingDirectory=/root/avalanchego/
ExecStart=/root/avalanchego/build/avalanchego \\
--chain-config-dir=/root/avalanchego/configs/chains \\
--config-file=/root/avalanchego/configs/chains/C/config.json \\
--api-metrics-enabled \\
--db-dir=/root/.local/share/avalanche/datadir \\
--http-host=0.0.0.0 \\
--http-port=9650 \\
--log-level=info \\
--log-dir=/root/.local/share/avalanche/logs \\
--network-id=mainnet \\
--public-ip-resolution-service=ifconfigMe \\
--network-allow-private-ips=false \\
--fd-limit=1000000
Restart=on-failure
LimitNOFILE=1000000
[Install]
WantedBy=default.target
If there are problems with determining the external IP when launching, you can try using another service — ifconfigMe. In my case, it helped.
- Download snapshot from ftp, all files from here should be saved in the folder ~mainnet/v1.4.5
aria2c --input-file=ava12.txt /root/.local/share/avalanche/datadir/mainnet/v1.4.5
But not all files were downloaded on the first try, I found a script in TheGraph’s Discord that simplifies the process of checking downloaded files and downloading missing ones. To do this, we read all .ldb files and download the missing ones (there are 6 more).
curl <ftp://mips:thegraph@dropbox.pinax.network/avalanche-datadir/part1/> |
grep -o '[0-9]*.ldb' |
awk '{print "<ftp://dropbox.pinax.network/avalanche-datadir/part1/>" $1}' > ava.txt
&& curl <ftp://mips:thegraph@dropbox.pinax.network/avalanche-datadir/part2/> |
grep -o '[0-9]*.ldb' |
awk '{print "<ftp://dropbox.pinax.network/avalanche-datadir/part2/>" $1}' >> ava.txt
Save to a file and then run aria to check and download missing parts from it.
aria2c --file-allocation=none -c -d /root/.local/share/avalanche/datadir/mainnet/v1.4.5 -x 16 -s 16 -j 20 --ftp-user=mips --ftp-passwd=thegraph --input-file=ava.txt
After downloading the snapshot to start the node, we will need to increase the limit of allocated Ubuntu resources. To do this, it is necessary to increase the number of allocated resources for one process in our case Avalanche.
How to check current limits in Ubuntu
ulimit -a
How to check the soft and hard open file limits
ulimit -Sn
ulimit -Hn
How to increase the open file limits for the current session in Ubuntu ulimit -n 1000000
How to increase per-user open file limits
sudo nano /etc/security/limits.conf
root hard nofile 2097152
root soft nofile 2097152
same here
sudo nano /etc/sysctl.conf
fs.file-max = 2097152
fs.nr_open = 2097152
load the kernel settings from the “sysctl.conf”
sudo sysctl -p
and here
sudo nano /etc/systemd/system.conf
DefaultLimitNOFILE=2097152:2097152