Product

Use Go for your next Apache Mesos framework

For more than five years, DC/OS has enabled some of the largest, most sophisticated enterprises in the world to achieve unparalleled levels of efficiency, reliability, and scalability from their IT infrastructure. But now it is time to pass the torch to a new generation of technology: the D2iQ Kubernetes Platform (DKP). Why? Kubernetes has now achieved a level of capability that only DC/OS could formerly provide and is now evolving and improving far faster (as is true of its supporting ecosystem). That’s why we have chosen to sunset DC/OS, with an end-of-life date of October 31, 2021. With DKP, our customers get the same benefits provided by DC/OS and more, as well as access to the most impressive pace of innovation the technology world has ever seen. This was not an easy decision to make, but we are dedicated to enabling our customers to accelerate their digital transformations, so they can increase the velocity and responsiveness of their organizations to an ever-more challenging future. And the best way to do that right now is with DKP.

Dec 13, 2013

Niklas Nielsen

D2iQ

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

 

Now we're ready to download and build the Go bindings from github.com/mesosphere/mesos-go:

 

$ 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!

 

A recording of the all tutorial steps is available as a showterm session and if you run into any troubles during this tutorial, feel free to send an email to support@mesosphere.io or help improve the project by creating an issue at github.com/mesosphere/mesos-go/issues.

Ready to get started?