[READ-ONLY] Mirror of https://github.com/andrioid/mysql-from-s3. MySQL server that seeds from S3 when run for the first time.
0

Configure Feed

Select the types of activity you want to include in your feed.

Will now try to detect 'lesser hardware' and scale down the MySQL config accordingly

+85 -3
+2 -1
Dockerfile
··· 14 14 cp gof3r /usr/local/bin 15 15 16 16 COPY docker-entrypoint.sh /entrypoint.sh 17 + COPY my-mini.cnf /my-mini.cnf 17 18 18 19 RUN chmod 755 /*.sh 19 20 20 - # TODO: Restore from S3 after we launch the database in the background 21 + # TODO: Do something to reduce the MySQL footprint, or get bigger machines
+10 -2
README.md
··· 2 2 3 3 It's essentially "[mysql:5.6](https://registry.hub.docker.com/_/mysql/)" from the official builds on Docker Hub, with a twist. You can find an automated build on [Docker Hub](https://registry.hub.docker.com/u/andrioid/mysql-from-s3/). 4 4 5 + Note: This is pretty early and I'm still fighting with a few bugs. It's a work in progress. 6 + 5 7 ## Introduction 6 8 7 9 ![If you persist your database to host and the host dies. You're gonna have a bad time.](http://i.imgur.com/8ZY9RkG.jpg) 8 10 9 - MySQL server that will seed the database from a gzipped dump file on S3 when run for the first time. 11 + MySQL server that will seed the database from a gzipped dump file on S3 when run for the first time. I use s3gof3r to stream the compressed dump file from S3. 12 + 10 13 11 - I use s3gof3r to stream the compressed dump file from S3. 14 + ### MySQL 5.6 and small VPS machines 15 + According to a [bug](https://github.com/docker-library/mysql/issues/3) MySQL 5.6 is not intended to run on tiny boxes. I'm not content with that, so if the server detects that your memory is below 1GB it will load a secondary configuration that will do the following: 16 + 17 + - Lower the memory footprint as much as possible 18 + - Disable InnoDB 19 + - Disable Performance Metrics 12 20 13 21 ## Use Cases 14 22
+11
docker-entrypoint.sh
··· 57 57 58 58 chown -R mysql:mysql "$DATADIR" 59 59 60 + ## Check during runtime if memory is low, then replace my.cnf with a minimal config 61 + ## See /proc/meminfo 62 + 63 + # Before: 726835200 64 + AVAILABLE_RAM=$(cat /proc/meminfo | grep MemAvailable | awk '{print $2}') 65 + #echo "Available RAM: $AVAILABLE_RAM" 66 + if [ $AVAILABLE_RAM -lt 1000000 ]; then 67 + echo "Low on RAM. Overriding my.cnf with a minimal config" 68 + cp /my-mini.cnf /etc/mysql/conf.d 69 + fi 70 + 60 71 /usr/sbin/mysqld "$MYSQL_PARAMS" & 61 72 62 73 #exec "$@" &
+62
my-mini.cnf
··· 1 + # /etc/my.cnf: 2 + [mysqld] 3 + 4 + innodb_buffer_pool_size=5M 5 + innodb_log_buffer_size=256K 6 + query_cache_size=0 7 + max_connections=5 8 + key_buffer_size=8 9 + thread_cache_size=0 10 + host_cache_size=0 11 + innodb_ft_cache_size=1600000 12 + innodb_ft_total_cache_size=32000000 13 + 14 + # per thread or per operation settings 15 + thread_stack=131072 16 + sort_buffer_size=32K 17 + read_buffer_size=8200 18 + read_rnd_buffer_size=8200 19 + max_heap_table_size=16K 20 + tmp_table_size=1K 21 + bulk_insert_buffer_size=0 22 + join_buffer_size=128 23 + net_buffer_length=1K 24 + innodb_sort_buffer_size=64K 25 + 26 + #settings that relate to the binary log (if enabled) 27 + binlog_cache_size=4K 28 + binlog_stmt_cache_size=4K 29 + 30 + performance_schema=off 31 + default-storage-engine=myisam 32 + default-tmp-storage-engine=myisam 33 + innodb=off 34 + 35 + # Neede to Disable InnoDB 36 + loose-innodb-trx=0 37 + loose-innodb-locks=0 38 + loose-innodb-lock-waits=0 39 + loose-innodb-cmp=0 40 + loose-innodb-cmp-per-index=0 41 + loose-innodb-cmp-per-index-reset=0 42 + loose-innodb-cmp-reset=0 43 + loose-innodb-cmpmem=0 44 + loose-innodb-cmpmem-reset=0 45 + loose-innodb-buffer-page=0 46 + loose-innodb-buffer-page-lru=0 47 + loose-innodb-buffer-pool-stats=0 48 + loose-innodb-metrics=0 49 + loose-innodb-ft-default-stopword=0 50 + loose-innodb-ft-inserted=0 51 + loose-innodb-ft-deleted=0 52 + loose-innodb-ft-being-deleted=0 53 + loose-innodb-ft-config=0 54 + loose-innodb-ft-index-cache=0 55 + loose-innodb-ft-index-table=0 56 + loose-innodb-sys-tables=0 57 + loose-innodb-sys-tablestats=0 58 + loose-innodb-sys-indexes=0 59 + loose-innodb-sys-columns=0 60 + loose-innodb-sys-fields=0 61 + loose-innodb-sys-foreign=0 62 + loose-innodb-sys-foreign-cols=0