<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: robertglonek</title>
    <description>The latest articles on Forem by robertglonek (@robertglonek).</description>
    <link>https://forem.com/robertglonek</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045240%2F83fc9569-aa79-4c11-b6a2-461c492c4fcc.png</url>
      <title>Forem: robertglonek</title>
      <link>https://forem.com/robertglonek</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/robertglonek"/>
    <language>en</language>
    <item>
      <title>Creating Aerospike test clusters with AeroLab in AWS</title>
      <dc:creator>robertglonek</dc:creator>
      <pubDate>Tue, 14 Mar 2023 17:54:48 +0000</pubDate>
      <link>https://forem.com/aerospike/creating-test-clusters-with-aerolab-in-aws-40c5</link>
      <guid>https://forem.com/aerospike/creating-test-clusters-with-aerolab-in-aws-40c5</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ttoE58GW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://developer-hub.s3.us-west-1.amazonaws.com/97730019/mess_1677705424525.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ttoE58GW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://developer-hub.s3.us-west-1.amazonaws.com/97730019/mess_1677705424525.png" width="715" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lab is fun&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aerospike.com/tools/aerolab"&gt;AeroLab&lt;/a&gt; simplifies the process of installing Aerospike clusters and clients for development, testing, and lab use on either Docker or in AWS. A rich feature set simulates network faults, quickly inserts and updates test data, partitions disks, and more.&lt;/p&gt;

&lt;p&gt;We will setup the following stack:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cluster - six nodes across two racks in two availability zones&lt;/li&gt;
&lt;li&gt;Monitoring - Prometheus Exporter on the cluster nodes and an Aerospike Monitoring Stack instance&lt;/li&gt;
&lt;li&gt;Clients - Aerospike tools instances where I will run &lt;a href="https://docs.aerospike.com/tools/asbench"&gt;&lt;code&gt;asbench&lt;/code&gt;&lt;/a&gt; - a benchmark tool&lt;/li&gt;
&lt;li&gt;Custom client - a Virtual Studio Code instance where I can develop my own code to interact with the database&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Install AeroLab
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Download AeroLab from &lt;a href="https://github.com/aerospike/aerolab"&gt;here&lt;/a&gt;,  then we choose the backend type to be AWS and pick our region:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab config backend -t aws -r us-west-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install AWS CLI with the instructions in &lt;a href="https://github.com/aerospike/aerolab/blob/master/docs/GETTING_STARTED.md#configure-aws-cli"&gt;this manual&lt;/a&gt;. (Ignore this if you already have it installed.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Because we are using the Enterprise Edition of Aerospike, we configure AeroLab to always use the feature key file for all relevant commands in the future:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab config defaults -k '*FeaturesFilePath' -v /path/to/features.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create security groups
&lt;/h2&gt;

&lt;p&gt;For safety, let's instruct AeroLab to create security group firewall rules, and protect them so that only our IP address can access the instances we create.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab config aws create-security-groups
aerolab config aws lock-security-groups
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Deploy the cluster
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;We deploy a 3-node cluster, preconfigured to already form correctly, using r5ad.4xlarge instances with NVMe disks in us-west-1a. We do not want the nodes to start at this point.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab cluster create -c 3 -n mycluster -I r5ad.4xlarge -U us-west-1a -s n
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add three more nodes, this time in another availability zone.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab cluster grow -c 3 -n mycluster -I r5ad.4xlarge -U us-west-1b -s n
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Instruct AeroLab to change the rack configuration on the nodes.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab conf rackid -n mycluster -l 1-3 --id=1 -e
aerolab conf rackid -n mycluster -l 4-6 --id=2 -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;We want to use the &lt;code&gt;test&lt;/code&gt; namespace, but we want to use all NVMe disks for that namespace as well. Let's create four partitions on each NVMe as well. Time to prepare the disks and configure Aerospike on all nodes:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab cluster partition create -n mycluster --filter-type=nvme -p 25,25,25,25
aerolab cluster partition conf -n mycluster --namespace=test --filter-type=nvme --configure=device
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;It is time to start Aerospike on all the nodes and check the logs on one of the nodes, specifically looking for a successful startup and the &lt;code&gt;CLUSTER-SIZE&lt;/code&gt; correctly showing six nodes.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab aerospike start -n mycluster
aerolab logs show -n mycluster --journal --follow --node=6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify, we query for basic cluster information using the &lt;code&gt;asadm&lt;/code&gt; command on one of the nodes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab attach shell -n mycluster -- asadm -e info
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install the monitoring stack
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Add the Prometheus Exporter to all the nodes to query Aerospike and gather the metrics.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab cluster add exporter -n mycluster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Deploy a special client machine with Prometheus database and Grafana preinstalled for Aerospike monitoring:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab client create ams -n mymonitor -s mycluster -I r5a.xlarge -U us-west-1a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;To access the Grafana dashboards on the monitoring stack, list the client machines:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab client list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Navigate in your browser to the node's IP on port 3000. For example: &lt;code&gt;http://127.0.0.1:3000&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Clients and client benchmark monitoring
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Start some client machines with Aerospike Tools packages preinstalled.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab client create tools -n myclients -c 5 -I r5a.xlarge -U us-west-1a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;asbenchmark&lt;/code&gt; monitoring to the monitoring stack, to populate the client graphs.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab client configure tools -l all -n myclients --ams mymonitor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Generating the load
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Run the following &lt;code&gt;asbench&lt;/code&gt; command to insert data.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;asbench -h ${NODEIP}:3000 -U superman -Pkrypton -n test -s \$(hostname) --latency -b testbin -K 0 -k 1000000 -z 16 -t 0 -o I1 -w I --socket-timeout 200 --timeout 1000 -B allowReplica --max-retries 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use the following command to run a read-update load.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;asbench -h ${NODEIP}:3000 -U superman -Pkrypton -n test -s \$(hostname) --latency -b testbin -K 0 -k 1000000 -z 16 -t 86400 -g 1000 -o I1 -w RU,80 --socket-timeout 200 --timeout 1000 -B allowReplica --max-retries 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Instruct AeroLab to run all the commands on all the client tools instances. First, get the IP addresses.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NODEIP=$(aerolab cluster list -j |grep -A7 mycluster |grep IpAddress |head -1 |egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}')
echo "Seed: ${NODEIP}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use the following commands to run &lt;code&gt;asbench&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab client attach -n myclients -l all --detach -- /bin/bash -c "run_asbench -h ${NODEIP}:3000 -U superman -Pkrypton -n test -s \$(hostname) --latency -b testbin -K 0 -k 1000000 -z 16 -t 0 -o I1 -w I --socket-timeout 200 --timeout 1000 -B allowReplica --max-retries 2"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab client attach -n myclients -l all --detach -- /bin/bash -c "run_asbench -h ${NODEIP}:3000 -U superman -Pkrypton -n test -s \$(hostname) --latency -b testbin -K 0 -k 1000000 -z 16 -t 86400 -g 1000 -o I1 -w RU,80 --socket-timeout 200 --timeout 1000 -B allowReplica --max-retries 2"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Custom client
&lt;/h2&gt;

&lt;p&gt;Use the following command to create an instance with &lt;code&gt;vscode&lt;/code&gt; preinstalled with &lt;code&gt;c#,java,python,golang&lt;/code&gt; libraries already configured for development.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab client create vscode -n vscode -I r5a.medium
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;aerolab client list&lt;/code&gt; to get the client list and display the IP addresses. To connect to the full IDE, open the &lt;code&gt;vscode&lt;/code&gt; client IP port &lt;code&gt;8080&lt;/code&gt; in your browser. For example: &lt;code&gt;http://1.2.3.4:8080&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;AeroLab simplifies the deployment of a custom-configured Aerospike cluster with test clients, a test load and a monitoring stack. Many more features exist to ease further configuration and installation. To view a list of commands, AeroLab has a useful &lt;code&gt;help&lt;/code&gt; parameter that can be appended anywhere, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aerolab help
aerolab cluster help
aerolab cluster create help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>aerolab</category>
      <category>aws</category>
      <category>cluster</category>
      <category>create</category>
    </item>
  </channel>
</rss>
