Skip to content

Instantly share code, notes, and snippets.

@nlapshin
nlapshin / gist:64181ceabb00715ff8c1548e3b2742d5
Created July 15, 2021 08:30
clickhouse useful commands
clickhouse-client --query="SELECT * FROM table FORMAT Native" > table.native
Native is the most efficient format
CSV, TabSeparated, JSONEachRow are more portable: you may import/export data to another DBMS.
Dump of metadata:
clickhouse-client --query="SHOW CREATE TABLE table" --format=TabSeparatedRaw > table.sql
Restore of metadata:
clickhouse-client < table.sql
@nlapshin
nlapshin / gist:eefd3bc2f7d5214de9540e911e1ae4a2
Last active November 14, 2020 13:30
mongodb-useful-commands
# Copy database from one server to another server
mongodump --host <from_host> --db <from_db> --archive | mongorestore --host <to_host> --archive
# Restore database(or collection) to another database(or collection)
mongorestore --gzip --archive=${BACKUP_FILE_GZ} --nsFrom "${DB_NAME}.*" --nsTo "${DB_NAME_RESTORE}.*"
@nlapshin
nlapshin / docker_compose_install.sh
Last active May 2, 2026 09:48
docker_compose_install.sh
#!/bin/bash
set -e
echo "🧹 Remove old Docker (if exists)..."
sudo apt-get remove -y docker docker-engine docker.io containerd runc || true
echo "📦 Install dependencies..."