Frameworks are important pieces of the Apache Mesos eco-system, and they relate to the Mesos core in ways similar to how applications relate to traditional operating system kernels. Mesos manages the resource offers presented to frameworks, which in turn perform useful work with those resources.
Today you can already use Java (and other JVM languages), Python, and C++ to write frameworks and executors. We are excited to announce that you can start using
Go as well.
This blog post will walk through how to get started using Go on an Apache Mesos cluster. We will use an
Elastic Apache Mesos cluster as the foundation for this tutorial, so if you do not have a cluster running, go ahead and launch one now.
When the cluster is up and running, ssh into the current leading master node and record the IP of the HDFS name node. If you can't find the address of the master, take a look at the confirmation email from Elastic Apache Mesos. The HDFS name node address should be the first master address and the leading master can be found by going to the Mesos UI.
After logging into the leading master node, install the build dependencies for the Go language bindings:
$ sudo aptitude install make g++ libprotobuf-dev mercurial golang
$ wget https://github.com/mesosphere/mesos-go/archive/master.zip$ unzip master.zip$ cd mesos-go-master$ export GOPATH=`pwd`$ make
The same makefile also builds our example framework and executor. The resulting executables can be found in ./bin/example_framework and ./bin/example_executor.
To run the example Go executors in your cluster, first place the executable in a shared location. For example in HDFS:
$ hadoop fs -mkdir /go-tmp$ hadoop fs -put ./bin/example_executor /go-tmp
Then finally, to launch the example Go framework:
$ ./bin/example_framework -executor-uri hdfs://<hdfs-name-node>/go-tmp/example_executor
Note that <hdfs-name-node> should be replaced by the HDFS namenode which you recorded at the beginning of this tutorial.
If all goes well, you should see output similar to following:
I1213 22:17:21.553354 9463 sched.cpp:224] No credentials provided. Attempting to register without authenticationLaunching task: 1Launching task: 2Launching task: 3Received task status: Go task is running!Received task status: Go task is done!Launching task: 4Received task status: Go task is running!Received task status: Go task is done!Received task status: Go task is running!Received task status: Go task is done!Received task status: Go task is running!Received task status: Go task is done!Launching task: 5Launching task: 6Launching task: 7Received task status: Go task is running!Received task status: Go task is running!Received task status: Go task is running!Received task status: Go task is done!