The first step is to author a json file describing the VM. Here is mine as an example:
It is almost the minimal file. Let’s have a look at the different parts:
- alias: an alias to your VM, it appears when you do vmadm list in the global zone.
- hostname: the name of the VM, it appears when you log into it instead of the UUID.
- brand: stick with joyent as it is a SmartOs VM.
- dataset_uuid: the uuid of the Joyent dataset to use. To know what to put there, see Stu Radnidge’s explanations.
- max_physical_memory: in MiB.
- quota: the size of the disk available for the VM.
- nics: the network interface:
- nic_tag: if you are going to only use one, put “admin”.
- ip, netmask, gateway: although the docs state you can put dhcp there, it does not quite work: it ip obtained by dhcp will not be put in the several config files and your VM will not work properly.
Write at least three of them, changing the names and ips to make them different and push them to the GZ.
You can then create your VMs using vmadm create -f riak1.json and log into them using zlogin and the uuid. It is the only way at this point as the root user does not have a password.
With riak ping and riak version, you will see that riak is running, but an old version (1.1.4).
Here is the way to upgrade to the latest version:
- stop riak: svcadm disable riak (sometimes, it doesn’t work and you required to do a riak stop.)
- get the tar.gz from Basho’s website. 1.2.1 is at http://downloads.basho.com.s3-website-us-east-1.amazonaws.com/riak/1.2/1.2.1/smartos/11/riak-1.2.1-SmartOS-i386.tgz
- remove the current riak package: pkg_delete riak
- add the newer package: pkg_add riak-1.2.1-SmartOS-i386.tgz.
- modify app.config (located in /opt/local/etc/riak) to fit your installation:
- replace 127.0.0.1 by the correct ip in three location.
- if you want to use 2i, replace the storage_backend value by riak_kv_eleveldb_backend.
- modify vm.argsto fit your installation:
- set -name to riak@<yourip>
- set -setcookie to any value, but it has to be the same on all the VMs that will join the cluster.
- as it is a fresh installation, remove the ring folder in /var/db/riak to take into account the modifications of vm.args.
- start riak with svcadm enable riak-epmd and svcadm enable riak. Sometimes, you may need to use riak start.
- it may take a while. You can check that something is happening by checking prstat.
Once you have done that to all the VMs you want to have in your cluster, you can have them form a cluster. On one of the node, issue a riak-admin cluster join riak@,anothernodeip> for each of the other nodes you want to have in your cluster. The command riak-admin status | grep ring_members should echo an array of all the your cluster nodes:
[root@riak1 ~]# riak-admin status | grep ring_members
ring_members : ['firstname.lastname@example.org.XX.X1','email@example.com.XX.X2','firstname.lastname@example.org.XX.X4']