0% found this document useful (0 votes)
2 views26 pages

Arangodb - Hands-On Labs - Section a - Arangodb Fundamentals

The document is a training guide for ArangoDB, detailing hands-on labs and installation procedures. It includes sections on environment setup, ArangoDB fundamentals, and development operations, along with specific lab instructions for tasks like enabling remote access and securing deployments. Additionally, it provides credentials, license key information, and a list of environments for participants to use during the training.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views26 pages

Arangodb - Hands-On Labs - Section a - Arangodb Fundamentals

The document is a training guide for ArangoDB, detailing hands-on labs and installation procedures. It includes sections on environment setup, ArangoDB fundamentals, and development operations, along with specific lab instructions for tasks like enabling remote access and securing deployments. Additionally, it provides credentials, license key information, and a list of environments for participants to use during the training.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

A RANGODB

TRAINING
Hands On Labs

Version 0.7

ArangoDB | 415 Mission Street, Floor 37, San Francisco,


CA 94104, United States
1 TABLE OF CONTENTS
1 SECTION I: ENVIRONMENT ACCESS / SETUP................................................................. 2

1.1 CREDENTIALS.................................................................................................... 2
1.2 LICENSE KEY.................................................................................................... 2
1.3 LIST OF ENVIRONMENTS...................................................................................... 3

2 SECTION A: ARANGODB FUNDAMENTALS................................................................... 4

2.1 INSTALLATION.................................................................................................. 4

SECTION A
2.1.1 L A-1: I
AB Y B .....................................................................................4
NSTALL OUR INARIES

A
2.1.2 L A-2: E
RANGO
AB

2.1.3 L A-3: S
AB
DB
R
F A ..................................................................................5
UNDAMENTALS
NABLE EMOTE CCESS

...............................................................................6
ECURE YOUR DEPLOYMENT

2.1.4 LAB A-4: SET YOUR ARANGODB LICENSE.........................................................................6


2.1.5 LAB A-5: WEBUI WALKTHROUGH.....................................................................................7
2.1.6 LAB A-6: DOCKER INSTALL..............................................................................................8
2.1.7 LAB A-7: K8S INSTALL.....................................................................................................9
2.1.8 LAB A-8: ARANGO GRAPH SETUP....................................................................................10
2.1.9 LAB A-8: MARKET PLACE...............................................................................................10
2.1.10 LAB A-10: STARTER INSTALL FOR CLUSTER....................................................................10
2.1.11 LAB A-11: STARTER INSTALL FOR CLUSTER (ONE SHARD)................................................13
2.1.12 LAB A-12: DOCUMENT BASICS......................................................................................13
2.1.13 LAB A-13: ARANGOSH BASICS.......................................................................................16
2.1.14 LAB A-14: REPLICAS AND WRITE CONCERN...................................................................18
2.1.15................................................. LAB A-15: REVISION ID
.......................................................................................21
2.1.16 LAB A-16: OPTIMISTIC LOCKING / COMPARE AND SWAP / CONSISTENT ATOMIC UPDATES 22
2.1.17 LAB A-17: INDEX BASICS..............................................................................................22

3 SECTION II: ARANGODB DEVELOPMENT................................................................... 23

Page 1 of 26
4 SECTION II: ARANGODB OPERATIONS...................................................................... 24

Page 2 of 26
ARANGODB TRAINING: HANDS-ON LABS

1 ENVIRONMENT ACCESS / SETUP

1.1 CREDENTIALS
Use the following credentials to log in to the lab environments.

# Environment Username Password Ports

1. ssh arangolabs $umm3r$un 22

2. Web UI root $umm3r$un 8529,


18529,
28529
38529,
45829

3. jupyter-labs @utumnL3@v3 8080


$

1.2LICENSE KEY
NOTE: Instructor to paste the latest license key here. The validUntil
needs to be at least until the last day of the training
{
"license":
"eyJncmFudCI6ImV5Sm1aV0YwZFhKbGN5STZleUpFWVhSaFUyTnBaVz
VqWlZCaFkydGhaMlVpT25zaVptVmhkSFZ5WlhNaU9sc2lSM0poY0doT
lRDSmRmU3dpZG1semRXRnNhWHBsY2lJNmV5SjFjMlZ5Y3lJNk1UQjlM
Q0psZUhCcGNtVnpJam94TnpRMk1EZ3lOems1ZlN3aWJtOTBRbVZtYjN
KbElqb2lNakF5TlMwd05DMHdOMVF4Tnpvd01Ub3lObG9pTENKdWIzUk

Page 3 of 26
ARANGODB TRAINING: HANDS-ON LABS

JablJsY2lJNklqSXdNalV0TURVdE1ERlVNRFk2TlRrNk5UbGFJaXdpY
zNWaWFtVmpkQ0k2ZXlKbGJXRnBiQ0k2SWlCeVlXcDFRR0pzZFdWd1lX
d3VZMjl0SW4wc0ltbHpjM1ZsY2lJNmV5SmpiMjF3WVc1NUlqb2lRWEp
oYm1kdlJFSWdSMjFpU0NJc0ltNWhiV1VpT2lKVWFXeHNiV0Z1SUVScG
MzTmxiR3RoYlhBaUxDSmxiV0ZwYkNJNkluUnBiRzFoYmk1a2FYTnpaV
3hyWVcxd1FHRnlZVzVuYjJSaUxtTnZiU0o5TENKamRYTjBiMjFsY2lJ
NmV5SnVZVzFsSWpvaVFteDFaWEJoYkNJc0ltVnVkbWx5YjI1dFpXNTB
Jam9pVUdGeWRHNWxjaUJVY21GcGJtbHVaeUlzSW05bGJTSTZJaUo5TE
NKMlpYSnphVzl1SWpveGZRPT0iLCJzaWduYXR1cmUiOiJHcTJsV2pKa
ndrYVdYTlQ4Mk0wRmlyK2xFRkZXM0lyODNZWTBlallXQi9oKzk3bGVN
cnlSdjZUQkJFV1IzWWNsV3FjU1ZzRktJSWwrUVQ0bHFGSktVS21Idm0
1QTZUcGdUR1FDUGtmM3RPRkp1T2JuTUlmYXRuci9ydkZ6dWRJODFwUE
k3R3RaeXYyWVQwN0ZIbXRpRTF5YWRWNTZkYWU0bGJWcnp1UEprWXEyR
245N1dwTEFvampzaHl0WEhMVWdVL3JrYW1wb1Fuc1ZUWjhrbkVmbjRX
ZTJZdzRaZllnUnJlaVpqejJNVkNJQkQxektxbmFJRzI4azVNRHhqODE
1YS96cnVKZW11bkc5VHNidXBTSzNGUkdjVWdnVndpV25VUlg2OXF1Sk
VaMlJhUzd3TE45b1NBY0plVlgzQ3dWWkM5T1RNSkZUSE1JSzZVNDFSb
U9sbWc9PSJ9",
"validUntil": "2024-08-18T23:59:59Z",
"validUntilLocal": "8/18/2024",
"daysToExpiry": 24
}

1.3LIST OF ENVIRONMENTS
Please enter your name against one of the nodes in the google sheet
here

Page 4 of 26
ARANGODB TRAINING: HANDS-ON LABS

2 ARANGODB FUNDAMENTALS
2.1INSTALLATION

2.1.1LAB A-1: INSTALL YOUR BINARIES

1. Login to your instance you selected in Section 1.3 using the


credentials provided

ssh arangolabs@<ec2. … .com>


2. Download / Install the binaries for your platform

sudo rpm -i arangodb3e-<arangodb version>.x86_64.rpm


3. Verify the the arangodb instance has started correctly

sudo systemctl status arangodb3


4. Start your arangodb instance (if it’s not running already)

sudo systemctl start arangodb3


5. Verify that the Web Interface is functional

curl -L http://localhost:8529
6. Next try accessing the arangodb instance remotely by entering
the following url into your browser

http://<your hostname>:8529
7. The host access should fail

Page 5 of 26
ARANGODB TRAINING: HANDS-ON LABS

2.1.2 LAB A-2: ENABLE REMOTE ACCESS

1. Make sure you are logged to your instance you selected in


Section 1.3 using the credentials provided

2. Enable remote access for your deployment by editing the


arangod.conf

sudo vi /etc/arangodb3/arangod.conf
3. Edit the following line:

a. Original Line:

endpoint = tcp://127.0.0.1:8529
b. Edited Line:

endpoint = tcp://0.0.0.0:8529
4. Make sure you are editing the line which is not commented i.e.
does not start with #

5. Save your edits and quit

6. Start your arangodb instance

sudo systemctl restart arangodb3


7. Verify the the arangodb instance has started correctly

sudo systemctl status arangodb3


8. Verify that you can access the arangodb instance remotely by
entering the following url into your browser

http://<your hostname>:8529

Page 6 of 26
ARANGODB TRAINING: HANDS-ON LABS

9. Your access to the environment should now succeed

2.1.3 LAB A-3: SECURE YOUR DEPLOYMENT

1. Make sure you are logged to your instance you selected in


Section 1.3 using the credentials provided

2. Stop your arangodb instance

sudo systemctl stop arangodb3


3. Secure your instance with a new password

sudo arango-secure-installation
4. Specify and confirm your ‘root’ password once requested

5. Restart the service:

sudo systemctl start arangodb3


6. Navigate to:

http://<your hostname>:8529
7. Login with the password you just specified for root

2.1.4 LAB A-4: SET YOUR ARANGODB LICENSE

1. Make sure you are logged to your instance you selected in


Section 1.3 using the credentials provided

Page 7 of 26
ARANGODB TRAINING: HANDS-ON LABS

ssh arangolabs@<your host/instance name>


2. Connect to the local arango instance using arangosh

arangosh
3. Enter your root password when prompted

4. Run the following command the prompt:

127.0.0.1:8529@_system> db._setLicense("<your
license key>")
5. Note: The license key is the value of the attribute “license” in
Section 1.2. Please DO NOT select the whole JSON.

2.1.5 LAB A-5: WEBUI WALKTHROUGH

1. Connect to the WebUI of your instance

http://<your hostname>:8529

Page 8 of 26
ARANGODB TRAINING: HANDS-ON LABS

2. Validate your ArangoDB version on the bottom-left and top-left.


The actual version number may vary depending upon when this
lab was conducted.

3. Verify the username being used and the database you are
connected to.

Page 9 of 26
ARANGODB TRAINING: HANDS-ON LABS

4. Navigate to the Dashboard > Statistics look at the summary


metrics being presented

5. Navigate to the Dashboard > System Resources look at the


summary metrics being presented

6. Navigate to the Dashboard > Metrics and look at the counters


being presented.

a. These counters are also exposed via the Prometheus


exporter for use in tools such as Grafana, DataDog, etc.

7. Scroll down further to review the histograms

8. Explore other sections of the interface (you will need them later)

2.1.6 LAB A-6: DOCKER INSTALL

1. Confirm you have docker running on your system and you have
the right permissions

docker ps
2. Run the following command to start the docker deployment

docker run -e ARANGO_ROOT_PASSWORD='W1nt3rR@1n' -p


18529:8529 --name arango -d arangodb
3. Confirm the instance was started successfully:

docker ps
4. Confirm you can access the WebUI via your browser. Note the
extra 1 in the port number.

http://<your hostname>:18529

Page 10 of 26
ARANGODB TRAINING: HANDS-ON LABS

5. Login with the credentials to make sure that you can log into the
instance

2.1.7 LAB A-7: K8S INSTALL

NOTE:
1. You need your own fully configured K8s environment for this
lab, along with the requisite permissions for K8s
2. Currently ArangoDB does not provide a lab environment for a
K8s deployment (coming in the future)
1. Confirm you have kubectl install and all the requisite permissions
to apply yaml to the k8s cluster

2. Make sure the kube-arango operator has been installed by your


K8s administrator and appropriate node pools are configured for
your nodes with enough resources

3. Obtain the following example YAML files to your local directory

https://github.com/arangodb/kube-arangodb/tree/master/examples

4. Create a namespace with your name

kubectl create namespace <your full name>

5. Apply one or more yaml files to spin up a cluster

kubectl apply -f <your yaml file> -n <your namespace>


6. Verify that the cluster comes up healthy

kubectl get pods -n <your namespace>

Page 11 of 26
ARANGODB TRAINING: HANDS-ON LABS

2.1.8 LAB A-8: ARANGO GRAPH SETUP

1. Follow the instructions on developer hub here

2.1.9 LAB A-8: MARKET PLACE

1. Visit the AWS or Google Marketplace and locate the ArangoGraph


listing

2. ArangoDB is also available on the HPE GreenLake Marketplace

2.1.10 LAB A-10: STARTER INSTALL FOR CLUSTER

1. Check with

docker ps
if the docker container is still running. Stop it if necessary.

2. Use the starter tool (arangodb) to first create a jwt secret

arangodb create jwt-secret --


secret=secrets/arangodb.secret
6. Restrict permissions on the file

chmod 400 secrets/arangodb.secret


7. Start the following commands in different terminals:

Starter 1:

arangodb --starter.data-dir=data/db1 --
starter.mode=cluster
--auth.jwt-secret=secrets/arangodb.secret --
starter.port=18528 --starter.join=localhost:18528
[CTRL]+Z; bg 1

Page 12 of 26
ARANGODB TRAINING: HANDS-ON LABS

Starter 2:

arangodb --starter.data-dir=data/db2 --
starter.mode=cluster
--auth.jwt-secret=secrets/arangodb.secret --
starter.port=28528 --starter.join=localhost:18528
Starter 3:

arangodb --starter.data-dir=data/db3 --
starter.mode=cluster
--auth.jwt-secret=secrets/arangodb.secret --
starter.port=38528 --starter.join=localhost:18528

3. The Starter uses the next few ports above the Starter port for the
cluster nodes. If you use port 8528 for the Starter

a. The Coordinator uses 8529 (=8528+1)

b. The DB-Server 8530 (=8528+2)

c. The Agent 8531 (=8528+3)

4. You should see a message similar to this once all the


subprocesses are up:

5. The default password for starter instances is blank/empty


password

6. You can change the password by logging into the webui

7. Alternatively you can set the password using arangosh

arangosh --server.endpoint your-server-endpoint \

Page 13 of 26
ARANGODB TRAINING: HANDS-ON LABS

--server.password "" \
--javascript.execute-string
'require("@arangodb/users").update("root",
"$umm3r$un");'
8. Next connect to the arangosh

arangosh --server.endpoint tcp://localhost:18529

9. Set your license key as in the previous labs

db._setLicense("<license key from your instructor>")

10. You should receive a 201 response with no error

11. Analyze the output of the following command

ps -ef|grep arangodb
12. You should be able to see the following:

a. 3 Starter processes

b. 3 DB Server Subprocesses

c. 3 Coordinator Subprocesses

d. 3 Agency subprocesses

13. Check the ptree of the primary agency process using

pstree <pid> -a

Page 14 of 26
ARANGODB TRAINING: HANDS-ON LABS

14. Note: To simulate the scenario, all processes and starters were
started on the same machine; this is great for development. In
production, however, you will end up deploying these processes
on different machines.

a. At times, the agency, coordinator, and observers could all


be on different machines. You can make this differentiation
by specifying --cluster.role either as PRIMARY or
DBSERVER or --cluster.role as COORDINATOR

--cluster.my-role DBSERVER

b. Agency is activated using

--agency.activate true

2.1.11 LAB A-11: STARTER INSTALL FOR CLUSTER (ONE SHARD)

1. What would you need to do to start this same cluster as One


Shard?

2.1.12 LAB A-12: DOCUMENT BASICS

1. Click DATABASES on the left Navigation

2. Click (+) Add Database

3. Specify the name of the database as test

4. Click Save

Page 15 of 26
ARANGODB TRAINING: HANDS-ON LABS

5. Click the _SYSTEM link on the top right to switch to the newly
created database

6. Choose test from the screen and click the green Select DB:test
button

Page 16 of 26
ARANGODB TRAINING: HANDS-ON LABS

7. Create a collection

a. Click COLLECTIONS on the left navigation

b. Click (+) Add Collection

c. Specify the collection name as mycollection

d. Leave the rest as defaults and click Save

8. Run the following AQL query:

Page 17 of 26
ARANGODB TRAINING: HANDS-ON LABS

INSERT {fname: "John", lname: "Smith"} into


mycollection return NEW
9. You should see the following output

10. Copy the _id field from the result and use it to access the
document and get only the last name

RETURN DOCUMENT("mycollection/33780").lname
11. BONUS:

a. Navigate to COLLECTIONS

b. Click mycollection

c. Click Content

d. Review the documents created

e. Manually create a document using the (+) green sign on the


top right corner

2.1.13 LAB A-13: ARANGOSH BASICS

1. You can either use the local arangosh installed on your training
server or choose to install the client tools locally on your machine.
The client tools can be found here:

https://arangodb.com/download/

Page 18 of 26
ARANGODB TRAINING: HANDS-ON LABS

2. Once you have installed the client you can use arangosh to
connect to a deployment

3. Simply typing arangosh will try and connect to a local deployment


on 8529

4. To connect to a specific deployment use:

arangosh --server.endpoint <your host>:18529


5. You should see the following:

6. Additional help information can be obtained using:

arangosh --help
7. Let's go through a few basic usage steps

8. To create a database

localhost:18529@_system> db._createDatabase("mydb");
9. To use the created database

localhost:18529@_system> db._useDatabase("mydb");
10. To get additional help:

localhost:18529@_system> db._help();
11. To run a for loop:
localhost:18529@_system> for (var i = 0; i < 10; i ++) {
...> require("@arangodb").print("Hello world " + i + "!\n");

Page 19 of 26
ARANGODB TRAINING: HANDS-ON LABS

...> }
12. BONUS: (See: JavaScript API)

a. Try creating a collection mycollection in mydb

b. Get properties of the collection

c. Add 10 documents to mycollection

d. Run an AQL Query to get all documents in the collection

e. Truncate mycollection

f. Drop database mydb

2.1.14 LAB A-14: REPLICAS AND WRITE CONCERN

1. Login into the ArangoDB UI into the _system database

2. Create a database testdb with a default replication factor of 2

3. Switch into the newly created database by clicking _SYSTEM at


the top right corner

Page 20 of 26
ARANGODB TRAINING: HANDS-ON LABS

4. Select the database testdb in the upcoming screen

Page 21 of 26
ARANGODB TRAINING: HANDS-ON LABS

5. Next create a collection with a replication factor of 4 does it


work? Why not?

6. Repeat the process via arangosh

localhost:28529@_system> db._useDatabase("testdb")

localhost:28529@testdb> db._create("mycollection",
{ replicationFactor: 4 },
{ enforceReplicationFactor: false });
7. Does it work? Why? Whats happening in the back end?

8. Next edit the collection properties and set the writeConcern to 4.


Will it work? Why or Why not?

Page 22 of 26
ARANGODB TRAINING: HANDS-ON LABS

2.1.15 LAB A-15: REVISION ID

1. Switch back into testdb you created in the WebUI

2. Go to the Queries section and run the following query

INSERT {_key: "mykey",fname:"John",lname:"Smith"} into


mycollection
return NEW

9. Copy the _rev value from the returned table

10. Next, run the following query

RETURN DECODE_REV("_h_59XG6--A")
11. What does the output show? What timezone is the output?

NOTE: Revision Ids are meant for optimistic locking and debugging
only please do not build business logic on the decoded value, the
implementation may change in the future

Page 23 of 26
ARANGODB TRAINING: HANDS-ON LABS

2.1.16 LAB A-16: OPTIMISTIC LOCKING / COMPARE AND SWAP /


CONSISTENT ATOMIC UPDATES

1. Run the following AQL query, by replacing your last obtained


revision id in <YOUR REVISION ID>

UPDATE { _key: "mykey", _rev: "<YOUR REVISION ID>" }


WITH { middlename: "Hammermill" } IN mycollection
OPTIONS { ignoreRevs: false }
RETURN NEW
2. Does the query work?

3. Run the query again without changing the revision id, does the
query work? Why ?

4. Run the same query by changing ignoreRevs: true but without


changing the revision id, does the query work? Why?

5. How would you implement concurrent writes with optimistic


locking when potentially the object has been overwritten before
you try to commit it?

2.1.17 LAB A-17: INDEX BASICS

12. Navigate to COLLECTIONS

13. Click mycollection

14. Click Indexes

Page 24 of 26
ARANGODB TRAINING: HANDS-ON LABS

15. Review the primary index – type primary, not sparse, 100%
selectivity, with _key as the indexed attribute and cannot be
deleted

Page 25 of 26

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy