Convert Mariadb/Mysql InnoDB to RocksDB on Ubuntu 20

$ sudo apt-get install mariadb-plugin-rocksdb

After installation, then restart your server.

Then run the following bash script

!/bin/bash

# Converts all InnoDB tables in all databases to ROCKSDB

 

DATABASES="db1 db2"     # Convert databases db1 and db2 only

 

#DATABASES="ALL"         # Convert all databases

MYSQL_USER=user

# Uncomment if you're not using ~/.my.cnf file (will receive "Warning: Using a password on the command line interface can be insecure" warnings)

MYSQL_PASS='MySecretPassword'

MYSQL_HOST=localhost

 

 

### no need to change anything below

# bail out on undefined variables

set -u

 

# mysql command we will use

#MYSQL_COMMAND="mysql -s -u "$MYSQL_USER" -h $MYSQL_HOST"

# Uncomment if you're not using ~/.my.cnf file (will receive "Warning: Using a password on the command line interface can be insecure" warnings)

MYSQL_COMMAND="mysql -s -u "$MYSQL_USER" --password="$MYSQL_PASS" -h $MYSQL_HOST"

 

# get a list of databases if we want to convert all databases

if [ "$DATABASES" == "ALL" ] ; then

    DATABASES=$(echo "SHOW DATABASES" | $MYSQL_COMMAND | egrep -v '(performance_schema|information_schema|mysql)')

fi

 

 

for DATABASE in $DATABASES ; do

    echo Converting $DATABASE

    # Check if the table is InnoDB (we don't want to convert ROCKSDB tables over and over again)

    TABLES=$(echo "SELECT TABLE_NAME FROM information_schema.TABLES where TABLE_SCHEMA = '$DATABASE' and (ENGINE = 'InnoDB' or ENGINE = 'Aria')" | $MYSQL_COMMAND)

    for TABLE in $TABLES ; do

        echo Converting InnoDB $TABLE to ROCKSDB

        echo "ALTER TABLE $TABLE ENGINE = ROCKSDB" | $MYSQL_COMMAND $DATABASE

        done

    if [ "x$TABLES" = "x" ] ; then

        echo No InnoDB tables found in $DATABASE database

    fi

    echo

done

  • RocksDB, Ubuntu, MariaDB, Proxmox
  • 25 Users Found This Useful
Was this answer helpful?

Related Articles

Create a Windows VM in Proxmox VE

Today, we will show you how to create a Windows VM in Proxmox. This may sound like a...

Installing macOS 12 “Monterey” on Proxmox 7

This tutorial for installing macOS 12 Monterey has been adapted for Proxmox from Kholia’s OSX-KVM...

Dynamic Host Configuration Protocol (DHCP)

The Dynamic Host Configuration Protocol (DHCP) is a network service that enables host computers...

How To Expand Ubuntu 20.04 LTS Filesystem Volume on Proxmox

Setup: Proxmox 7; Disk model: QEMU HARDDISK; Ubuntu 20.04.3 LTS   Expand the QEMU HARDDISK file...

ZFS vs. LVM: Side-by-Side Comparison

In this article, we will look at a side-by-side comparison of ZFS vs. LVM. ZFS and LVM are both...