Documentation
Other
Database

Database

To use Unown# services, you will need a database server with two different databases configured. One for Golbat and one for Dragonite. If you have an existing database feel free to continue using your existing service.

Supported

  • MariaDB 10.6 or higher (recommended)
  • MySQL 8 or higher

Create a database

Feel free to choose one of the following install methods. No matter your choice of Standard or Docker for hosting your database it is highly recommended that you create backups of your database.

Standard database setup

Standard installation is thoroughly documented on external sites like https://mariadb.org/ (opens in a new tab) and https://www.mysql.com/ (opens in a new tab). Please use one of those community guides for your specific platform.

Docker database setup

  1. Create a folder for storing your database files. This should ideally live on an fast and redundant SSD volume.

    mkdir database
  2. Sample service with docker:

    docker-compose.yml
    version: '3.7'
    services:
      db:
        image: mariadb:10.11
        command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password --binlog-expire-logs-seconds=86400
        container_name: db
        restart: unless-stopped
        environment:
          MYSQL_ROOT_PASSWORD: YourStrongRootPassw0rd!
          MYSQL_DATABASE: _temp
          MYSQL_USER: unownhash
          MYSQL_PASSWORD: YourStrongPassw0rd!
        ports:
          - 3306:3306
        volumes:
          - ./database:/var/lib/mysql
          #- ./my.cnf:/etc/mysql/conf.d/my.cnf # Example below
          #- /etc/localtime:/etc/localtime:ro
     
    networks:
      default:
        name: scanner
  3. Start the database

    docker compose up -d

Create your database tables

Once the database service is running, you will need to connect to the database service with TablePlus (opens in a new tab), Workbench (opens in a new tab), Command Line, etc. The default Encoding and Collation values should be fine for most configurations.

  1. Create a database for dragonite
  2. Create a database for golbat

Optimizing MariaDB

These options can help you quite significantly with performance.

my.cnf
[mysqld]
 
# This should be 50% of RAM, leaving space for golbat
innodb_buffer_pool_size = 64G
 
# Log file size, should certainly be >= 1GB, but on a big system this is more appropriate
innodb_log_file_size = 16G
 
# This should be number of cores
innodb_read_io_threads = 10
innodb_write_io_threads = 10
innodb_purge_threads = 10
 
# Some people receommend at least 1 per gb, so could be increased above
innodb_buffer_pool_instances = 8
 
# allow big sorts, in memory temp tables
max_heap_table_size=256M
 
# extend wait timeout for locks to ensure a good chance to finish requests
innodb_lock_wait_timeout = 15
 
# logs are written once per second rather than after
innodb_flush_log_at_trx_commit = 0
 
# background tasks can work at high iops
innodb_io_capacity=1000
 
# Number of maximum available IOPS to background tasks
innodb_io_capacity_max=2000
 
# Trust disk system at the expense of recovery
innodb_doublewrite = 0

These last two options prevent your ibdata1 file from growing continuously and space not being re-used. If you have this problem you can add these but be aware this requires recreation of ibdata.

my.cnf
# Efficiently use ibdata
innodb_undo_log_truncate = 1
innodb_undo_tablespaces = 4