Maria DB and the Mysterious Column Storage Engine
Not much of a preamble for this one. My friend was struggling getting Postgresql to work with a column storage engine because the directions were opaque and useless. I started helping her out but discovered that MariaDB is the same way. After a day or two of research, I wrote a bash script that does the install of everything and when I tested it on my own machine, it worked!
NOTE: This script is written and tested on an Ubuntu machine. You may have to tweak it for others.
#!/usr/bin/env bash
set -e
exec 2>error.log
log_error() {
echo "$(date '+%Y-%m-%d %H:%M:%S') ERROR: $1" | tee -a error.log
}
trap 'kill $SUDO_PID' EXIT
echo "This script will install MariaDB and the MariaDB extension Column Store."
echo "Do you wish to proceed? (Y/N)"
read -r proceed_time
if [[ "${proceed_time^^}" != "Y" ]]; then
echo "Exiting script..."
exit 1
fi
echo "Starting installation of MariaDB..."
# Check sudo access
if ! sudo -v; then
log_error "Sudo access denied. Exiting."
exit 1
fi
# Keep sudo alive in the background
( while true; do sudo -v; sleep 60; done ) &
SUDO_PID=$!
# Update package lists
if ! sudo apt update; then
log_error "Failed to update package lists."
exit 1
fi
# Install MariaDB
if sudo apt install -y mariadb-server mariadb-client; then
if systemctl is-active --quiet mariadb; then
echo "MariaDB server installed and running."
else
log_error "MariaDB server installation failed or not running."
exit 1
fi
else
log_error "Failed to install MariaDB."
exit 1
fi
# Prepare to install ColumnStore
echo "Preparing to install the MariaDB ColumnStore engine."
mkdir -p columnstore
pushd columnstore || exit 1
# Download and set up the MariaDB repo
if ! wget -q --show-progress https://downloads.mariadb.com/MariaDB/mariadb_repo_setup; then
log_error "Failed to download mariadb_repo_setup."
exit 1
fi
chmod +x mariadb_repo_setup
if ! sudo ./mariadb_repo_setup --mariadb-server-version="mariadb-10.6"; then
log_error "Failed to install Maria Repo."
exit 1
fi
# Update package lists again
if ! sudo apt update; then
log_error "Failed to update package lists after adding MariaDB repo."
exit 1
fi
# Install ColumnStore dependencies
if ! sudo apt install -y libjemalloc2 mariadb-backup libmariadb3 mariadb-plugin-columnstore; then
log_error "Failed to install ColumnStore dependencies."
exit 1
fi
# Verify ColumnStore installation
if ! sudo mariadb -e "SHOW PLUGINS" | grep -q "COLUMNSTORE"; then
log_error "ColumnStore plugin installation failed."
exit 1
fi
service mariadb restart
popd
echo "Installation complete."
© Jonathan Snyder. All Rights Reserved. Fediverse