|
1 | | -# azure-container-instances-couchbase |
| 1 | +## Couchbase Cluster on Azure Container Instances (ACI) |
| 2 | +___ |
| 3 | +#### What are Azure Container Instances |
| 4 | +ACI containers are conceptually similar to pods in Kubernetes. While not truly orchestration, ACI |
| 5 | +allows grouping around first-class container objects. The containers within the group can communicate with each other on a private network by default. |
| 6 | +External communication is established via a randomly assigned public IP.<br> |
| 7 | +It is important to be aware that ACI is in preview and is not for production use. |
| 8 | +#### Why use ACI |
| 9 | +ACI allows you to easily run containers on Azure with a single command. There is no managing of Virtual |
| 10 | +Machines and other infrastructure components. [Billing](https://azure.microsoft.com/en-us/pricing/details/container-instances/) |
| 11 | +is at a granularity of the duraction of cores, memory and requests. This is more flexible and accurate than the standard |
| 12 | +set VM size approach. |
2 | 13 |
|
3 | | -Describes how to use Azure Container Instances with Couchbase |
| 14 | +#### Prerequisites: |
| 15 | + |
| 16 | +* A Microsoft Azure account. Create an [account](https://azure.microsoft.com/en-us/free/) if required. |
| 17 | + |
| 18 | +The [Azure Cloud Shell](https://docs.microsoft.com/en-us/azure/cloud-shell/limitations) is command-line for this example so that the Azure Portal can be used exclusively. |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +#### Create a resource group |
| 23 | +``` |
| 24 | +s@Azure:~$ az group create -l eastus -n couchbaseonaciRG |
| 25 | +``` |
| 26 | +After successful creating the resource group the console prints the output: |
| 27 | +``` |
| 28 | +{ |
| 29 | + "id": "/subscriptions/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX/resourceGroups/couchbaseonaciRG", |
| 30 | + "location": "eastus", |
| 31 | + "managedBy": null, |
| 32 | + "name": "couchbaseonaciRG", |
| 33 | + "properties": { |
| 34 | + "provisioningState": "Succeeded" |
| 35 | + }, |
| 36 | + "tags": null |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +#### Create an ACI using the cloud shell: |
| 41 | + |
| 42 | + |
| 43 | +The provisioningState specifies "*Creating*".<br> |
| 44 | +Wait about a minute then execute the container show command to make sure the instance has been provisioned successfully: |
| 45 | + |
| 46 | +``` |
| 47 | +s@Azure:~$ az container show --name acicbexample -g couchbaseonaciRG |
| 48 | +``` |
| 49 | +Pay attention to the port, IP and provisioningState (should be *"Succeeded"*). |
| 50 | + |
| 51 | + |
| 52 | +We can begin starting the cluster by opening **http://\<IP\>:8091** in a web browser. |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +#### Start the cluster via the Web Console: |
| 57 | +1. Select "*Start a new cluster*". |
| 58 | +2. Set the "*Data RAM Quota*" and "*Index RAM Quota*" to 512 MB. |
| 59 | +3. Leave the other fields as the defaults and hit "*Next*". |
| 60 | +4. Choose the choose the "beer-sample" bucket and continue to hit "*Next*". |
| 61 | +5. Continue to hit "*Next*" following the instructions. |
| 62 | +6. On the final step enter a username and password for the administrator account. |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +The cluster is running, you will notice that you have one active server. |
| 67 | +#### Run a query |
| 68 | +We will use data from the beer-sample bucket chosen during setup for a N1QL query: |
| 69 | +1. Navigate to the "*Query*" tab. |
| 70 | +2. Type "select `beer-sample`.* from `beer-sample`;" (without the quotes) in the query text box and hit "*Execute*". |
| 71 | +3. Observe the results and explore the different output format tabs. |
| 72 | + |
| 73 | + |
| 74 | + #### Clean up |
| 75 | + Tear-down is simply deleting the container using the command: |
| 76 | + |
| 77 | + ```s@Azure:~$ az container delete --name acicbexample --resource-group couchbaseonaciRG --yes``` |
| 78 | + |
| 79 | + Now we can do a check that the container is gone by the command: |
| 80 | +  |
| 81 | + The command returned nothing, which indicates the container no longer exists. |
| 82 | + |
| 83 | + That is it! We are finished. Using ACI is that simple and easy. |
| 84 | + |
| 85 | + |
0 commit comments