Skip to content

Commit 2428d14

Browse files
committed
Added tips on performance
- Added a sync script for copying the files.
1 parent 1dce2de commit 2428d14

File tree

2 files changed

+86
-1
lines changed

2 files changed

+86
-1
lines changed

terra/README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ As it is, running the feeder on `ts-node` consumes over 100 MB of memory. Use th
4949

5050
```bash
5151
cd ~/oracle-feeder/feeder
52-
git apply ~/Downloads/validator-script/terra/sample/feeder.patch
52+
patch package.json ~/validator-script/terra/sample/feeder.patch
5353
npm run build
5454
```
5555

@@ -191,6 +191,8 @@ Once it is caught up:
191191

192192
(Reference: https://discord.com/channels/566086600560214026/566126867686621185/806929605629968396)
193193

194+
Use the file _sample/migrate.sh_ to copy the file from the old server to the new server **after stopping both servers**.
195+
194196
### Actual migration ###
195197

196198
The sequence of commands below needs to be **excuted in quick succession**.
@@ -281,6 +283,48 @@ When the feeder is running smooth for a while, the monitoring script can be star
281283
```bash
282284
bash oracle-monitor.sh terravaloper1rjmzlljxwu2qh6g2sm9uldmtg0kj4qgyy9jx24 http://localhost:1317
283285
```
286+
# Tips #
287+
288+
## Continuous TRIM ##
289+
290+
One performance tip for SSD storage technologies is the removal of continuous [TRIM](https://www.digitalocean.com/community/tutorials/how-to-configure-periodic-trim-for-ssd-storage-on-linux-servers).
291+
292+
Drives that have continuous TRIM enabled are mounted with the `discard` option. They can be found by running:
293+
294+
`findmnt -O discard`
295+
296+
_If_ there are drives that have this option, they can be remounted in place with the `-o` option:
297+
298+
`sudo mount -o remount,nodiscard /mnt/col`
299+
300+
In the _/etc/fstab_ file, the `discard` property needs to be removed so that when the drives get mounted on boot, continuous TRIM will not be enabled.
301+
302+
## Periodic TRIM ##
303+
304+
If continuous TRIM is disabled, periodic TRIM needs to be performed.
305+
306+
Create the cron script _/etc/cron.weekly/fstrim_:
307+
308+
```
309+
#!/bin/sh
310+
/usr/sbin/fstrim --all || true
311+
```
312+
313+
Then make the script executable:
314+
315+
```bash
316+
sudo chmod a+x /etc/cron.weekly/fstrim
317+
```
318+
319+
## Hostname ##
320+
321+
Some distributions may not set the hostname to match the name set in the dashboard.
322+
323+
The name can be permanently changed using `hostnamectl`:
324+
325+
```bash
326+
sudo hostnamectl set-hostname validator-terra
327+
```
284328

285329
# Fresh new setup
286330

terra/sample/migrate.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# ./migrate.sh -n
4+
# Performs a dry run.
5+
6+
# ./migrate.sh -t
7+
# Peforms the actual migration.
8+
9+
KEY_FILE=.terra/config/priv_validator_key.json
10+
STATE_FILE=.terra/data/priv_validator_state.json
11+
12+
while getopts tn var
13+
do
14+
if test $var = "t"
15+
then
16+
mkdir -p ~/backup1
17+
mv -i "~/$KEY_FILE" ~/backup1/
18+
mv -i "~/$STATE_FILE" ~/backup1/
19+
rsync terrau@validator2-terra:"$KEY_FILE" ~/.terra/config/ -e 'ssh -p 9560' -vzrc
20+
rsync terrau@validator2-terra:"$STATE_FILE" ~/.terra/data/ -e 'ssh -p 9560' -vzrc
21+
else
22+
echo "Copying "~/$KEY_FILE" to ~/backup"
23+
echo "Copying "~/$STATE_FILE" to ~/backup"
24+
rsync terrau@validator2-terra:"$KEY_FILE" ~/.terra/config/ -e 'ssh -p 9560' -vzrcn
25+
rsync terrau@validator2-terra:"$STATE_FILE" ~/.terra/data/ -e 'ssh -p 9560' -vzrcn
26+
fi
27+
done
28+
29+
if [[ -f ~/"$KEY_FILE" ]]; then
30+
key=`md5sum ~/"$KEY_FILE"`
31+
echo "Key: $key"
32+
else
33+
echo "~/$KEY_FILE does not exist."
34+
fi
35+
36+
if [[ -f ~/"$STATE_FILE" ]]; then
37+
state=`md5sum "~/$STATE_FILE"`
38+
echo "State: $state"
39+
else
40+
echo "~/$STATE_FILE does not exist."
41+
fi

0 commit comments

Comments
 (0)