Migrate InfluxDB databases to Docker

I have plenty of machine which running on old ways of Virtual Machine. Recently i’m interested to looking for a simpler, more automated approach to installation rather than install one by one each machine.

Currently i would like to migrate 1 set of Grafana, Influxdb, Prometheus to Docker. I will post more detail about docker later, but for this article i would like to write more specific to migrate from InfluxDB database to Docker.

InfluxDB Databases

First, let’s take a look at the InfluxDB databases. In this example, we are using version 1.8.10, and we have two databases that we want to back up: telegraf and librenms.

To see a list of the available databases, run the following command in the InfluxDB shell:

# influx -host 127.0.0.1 -port 8086
Connected to http://127.0.0.1:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> SHOW DATABASES;
name: databases
name
----
telegraf
_internal
librenms
> exit
#

Backup Databases

Once we’ve identified the databases that want to back up, run the following commands:

# influxd backup -portable -database telegraf ./influxdb-backup/telegraf
# influxd backup -portable -database librenms ./influxdb-backup/librenms

These commands will create portable backups of the databases in the specified directories. After required database backed up, then we can copy the directory using scp to destined docker host.

scp -r /root/influxdb-backup/ root@destination_docker_host:/home/

Restoring Databases

I have built several service related grafana monitoring using docker compose to provision these container.

  influxdb:
    image: influxdb:1.8.10
    container_name: influxdb
    ports:
      - "8086:8086"
    volumes:
      - /opt/appdata/influxdb:/var/lib/influxdb
    restart: unless-stopped

After container up then we stop the services using docker stop influxdb. Then we create intermediate container that maps the data volume and our backup directory and then enter the container’s shell:

# docker run --rm --detach -v /opt/appdata/influxdb:/var/lib/influxdb -v /home/influxdb-backup/:/backups -p 8086 influxdb:1.8.10
b87c1e0dcfbdc3250e65c9664cae00b39df9493334bb098ba58be54aeec6b281
# docker exec -it blissful_cori /bin/bash
root@b87c1e0dcfbd:/# influxd version
InfluxDB v1.8.10 (git: 1.8 688e697c51fd)
# influxd restore -portable -database telegraf /backups/telegraf
# influxd restore -portable -database librenms /backups/librenms
# exit

Then stop intermediate container and remove then start influxdb container.

docker stop blissful_cori

Now you can log in to the InfluxDB console and verify that the databases have been restored:

root@bb0711aa705e:/# influx -host 127.0.0.1 -port 8086
Connected to http://127.0.0.1:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> SHOW DATABASES;
name: databases
name
----
_internal
telegraf
librenms
>

Note that you should also check the InfluxDB version on the existing and new systems to ensure compatibility.

References :

https://dev.to/thibmaek/-migrating-influxdb-databases-to-docker-compose-2kee

Build Media Streaming Server using VIMP

Catatan kali ini saya tulis dari catatan saya ketika semasa SMK (sudah 2 tahun lalu), jadi kemungkinan kurang up-to-date dengan perkembangan terkini mulai dari aplikasi maupun sistem operasi yang dipakai. Namun masih bisa dipakai untuk bahan rujukan apabila ingin membuat video streaming sendiri secara pribadi.

Seperti halnya youtube, hasil akhir article ini kita akan membuat sebuah server layaknya seperti youtube dimana kita bisa mengupload file musik dan video. Saya menggunakan VIMP (versi baru OStube) sebagai CMS video streaming server kali ini. Meski begitu masih ada banyak CMS yang tersedia sebagai alternatif VIMP yang bisa dipakai.

vimp

VIMP merupakan salah satu CMS Streaming yang hampir seperti Youtube, jadi kita bisa mengunggah file video, musik, gambar, dokumen ke server yang kita buat dan di presentasikan kembali kepada pengunjung yang datang ke server kita.
Continue reading

[Need Help?] Network Design Consultation, Training & Deployment Services

Network-DesignGot headache about network solution or need training service? Im ready for you. I offer some service that related to networking and server solution. It is Free!! or you can donate a few 🙂 but Free is depend on how complicated problem that you have :p But the main purpose is i want to try help you to solve “problem that you have”, in other side i want to “boost up” and get new “problem” that i never found before to increase my network design skills & experience.

Continue reading