Member-only story

Go programming for Ceph

Basic setup for go accessing Ceph Clusters

DaeGon Kim
3 min readNov 21, 2022

This article will show how to set up a go environment for accessing Ceph clusters and provide a simple example code.

We use Ubuntu 20.04 as a base OS.

First, install go programming environment. Then install librbd-dev librados-dev, libcephfs-dev and gcc.

sudo apt install librbd-dev librados-dev libcephfs-dev gcc

GCC is required for building go programs that uses go-ceph package.

Then, we need to install go-ceph go package. It requires timespec package.

go get -u -v github.com/ceph/go-ceph
go get -u -v github.com/ceph/go-ceph/internal/timespec@v0.18.0

We assume that readers has a basic background in go programming. We do not cover go in details.

go-ceph Package

According the package documentation,

The go-ceph project is a collection of API bindings that support the use of native Ceph APIs, which are C language functions, in Go. These bindings make use of Go’s cgo feature.

There are three main Go sub-packages that make up go-ceph:

  • rados — exports functionality from Ceph’s librados
  • rbd — exports functionality from Ceph’s librbd
  • cephfs — exports functionality from Ceph’s libcephfs

rbd sub-package

--

--

No responses yet