Skip to content

Instantly share code, notes, and snippets.

@nerg4l
Last active May 9, 2021 14:28
Show Gist options
  • Save nerg4l/aa4d0527121d7334c963e6c77ce20f3a to your computer and use it in GitHub Desktop.
Save nerg4l/aa4d0527121d7334c963e6c77ce20f3a to your computer and use it in GitHub Desktop.
const { Database, aql } = require("arangojs");
const db = new Database({
databaseName: 'got',
});
const Characters = db.collection("characters");
let firstSuccess = false
async function main() {
try {
const characters = await db.query(aql`
FOR character IN ${Characters}
FILTER character.alive == true
RETURN character
`, {count: true});
if (!firstSuccess) {
console.log("Success:", characters.count);
firstSuccess = true
}
} catch (err) {
console.error(err.message);
firstSuccess = false
}
}
setInterval(main, 250);

SSH tunnel

ssh -l ec2-user <IP> -i ~/.ssh/cegjelzo.pem -L 9000:0.0.0.0:8529

Setup arango

cd /etc/yum.repos.d/
curl -OL https://download.arangodb.com/arangodb34/RPM/arangodb.repo
yum -y install arangodb3-3.4.3
systemctl start arangodb3
systemctl enable arangodb3
vim /etc/arangodb3/arangod.conf
// endpoint = tcp://0.0.0.0:8529
// storage-engine = rocksdb
// authentication = false
// maximal-threads = 2
systemctl restart arangodb3

Upgrade arango

yum -y remove arangodb3-3.4.3-1.0
curl -OL https://download.arangodb.com/arangodb34/RPM/arangodb.repo
yum -y install arangodb3-3.7.11
systemctl stop arangodb3
arangod --database.auto-upgrade true
systemctl start arangodb3
systemctl enable arangodb3

Replication

db._useDatabase("got");
require("@arangodb/replication").setupReplication({ endpoint: "tcp://<IP>:8529", verbose: false, includeSystem: false, incremental: true, autoResync: true });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment