Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-dockerfiles
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qg-dockerfiles
Commits
2f3a2069
Commit
2f3a2069
authored
Apr 23, 2018
by
kalvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql 5.7
parent
4aa72dc7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
157 additions
and
0 deletions
+157
-0
Dockerfile
baseimg/tools/db5.7/Dockerfile
+21
-0
init_db_data.sh
baseimg/tools/db5.7/init_db_data.sh
+79
-0
my.cnf
baseimg/tools/db5.7/my.cnf
+50
-0
mysqld_charset.cnf
baseimg/tools/db5.7/mysqld_charset.cnf
+7
-0
No files found.
baseimg/tools/db5.7/Dockerfile
0 → 100644
View file @
2f3a2069
FROM
mysql:5.7
#定义工作目录
WORKDIR
/var/lib/mysql
ENV
AUTO_RUN_DIR /docker-entrypoint-initdb.d
COPY
my.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
COPY
mysqld_charset.cnf /etc/mysql/conf.d/mysqld_charset.cnf
#把要执行的shell文件放到/docker-entrypoint-initdb.d/目录下,容器会自动执行这个shell
COPY
./init_db_data.sh $AUTO_RUN_DIR/
#给执行文件增加可执行权限
RUN
chmod
a+x
$AUTO_RUN_DIR
/init_db_data.sh
RUN
echo
"dash dash/sh boolean false"
| debconf-set-selections
RUN
DEBIAN_FRONTEND
=
noninteractive dpkg-reconfigure dash
# 解决时区问题
ENV
TZ=Asia/Shanghai
RUN
ln
-snf
/usr/share/zoneinfo/
$TZ
/etc/localtime
&&
echo
$TZ
>
/etc/timezone
\ No newline at end of file
baseimg/tools/db5.7/init_db_data.sh
0 → 100644
View file @
2f3a2069
# -------------------------------------------------------------------------------
# Filename: init_db_data.sh
# Revision: 1.0
# Date: 2017/08
# Author: dekun.dai
# Description: 执行目录下所有数据库脚本
# -------------------------------------------------------------------------------
# sql_file_folder=$WORK_PATH/sql_to_run
#
# echo "cd $sql_file_folder"
# cd $sql_file_folder
#
# for entry in ./*
# do
# echo "run sql file: $entry"
# mysql -uroot < $entry
# done
#!/bin/bash
export
NAMESPACE
=
`
cat
/var/run/secrets/kubernetes.io/serviceaccount/namespace
`
echo
"start replace db domain"
DB_FILE
=
dump.sql
HOST
=
$DB_SERVICE_HOST
PORT
=
'3306'
USER
=
'qa'
PASSWORD
=
'qatest'
HTTPS
=
'true'
echo
"HOST=
$HOST
PORT=
$PORT
USER=
$USER
PASSWORD=
$PASSWORD
HTTPS=
$HTTPS
NAMESPACE=
$NAMESPACE
"
EXCLUDED_TABLES
=(
clotho.JOB_EXECUTION_LOG
clotho.JOB_STATUS_TRACE_LOG
notify.JOB_EXECUTION_LOG
notify.JOB_STATUS_TRACE_LOG
xyqb.JOB_EXECUTION_LOG
xyqb.JOB_STATUS_TRACE_LOG
xyqb.channel
xyqb.t_phonenum
mall.jd_address
mall.jd_brand
mall.jd_product_sku_image
mall.jd_property
mall.jd_sku
mall.jd_sku_detail_image
mall.jd_sku_specs
mall.spu_image
mall.sale_product_detail
mall.product_nature_value_bak
mall.product_sku
mall.product_sku_image
mall.product_specification
mall.product_spu
)
IGNORED_TABLES_STRING
=
''
for
TABLE
in
"
${
EXCLUDED_TABLES
[@]
}
"
do
:
IGNORED_TABLES_STRING+
=
" --ignore-table=
${
TABLE
}
"
done
echo
"mysqldump --host=
${
HOST
}
--port=
${
PORT
}
--user=
${
USER
}
--password=
${
PASSWORD
}
--all-databases --no-create-info
${
IGNORED_TABLES_STRING
}
>>
${
DB_FILE
}
"
mysqldump
--host
=
${
HOST
}
--port
=
${
PORT
}
--user
=
${
USER
}
--password
=
${
PASSWORD
}
--all-databases
${
IGNORED_TABLES_STRING
}
>>
${
DB_FILE
}
echo
"sed file"
if
[[
$HTTPS
=
true
]]
;
then
sed
-i
"s#
\.
xyqb
\.
com#-
${
NAMESPACE
}
\.
q-gp
\.
com#g; s#
\.
quantgroup
\.
cn#-
${
NAMESPACE
}
\.
q-gp
\.
com#g; s#-base
\.
q-gp
\.
com#-
${
NAMESPACE
}
\.
q-gp
\.
com#g"
${
DB_FILE
}
else
sed
-i
"s#
\.
xyqb
\.
com#-
${
NAMESPACE
}
\.
q-gp
\.
com#g; s#
\.
quantgroup
\.
cn#-
${
NAMESPACE
}
\.
q-gp
\.
com#g; s#-base
\.
q-gp
\.
com#-
${
NAMESPACE
}
\.
q-gp
\.
com#g; s#
\h
ttps#http#g"
${
DB_FILE
}
fi
echo
"mysql dump file"
mysql
--host
=
${
HOST
}
--port
=
${
PORT
}
--user
=
${
USER
}
--password
=
${
PASSWORD
}
<
${
DB_FILE
}
\ No newline at end of file
baseimg/tools/db5.7/my.cnf
0 → 100644
View file @
2f3a2069
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-bin=/var/lib/mysql/mysql-bin
binlog-format=ROW
server_id=1
innodb_buffer_pool_size = 512M
innodb_buffer_pool_instances = 1
bulk_insert_buffer_size = 32M
query_cache_type = 0
query_cache_size = 0
max_connections = 1024
max_connect_errors = 10
table_open_cache = 4096
max_allowed_packet = 512M
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 8M
read_rnd_buffer_size = 16M
sort_buffer_size = 32K
join_buffer_size = 32K
thread_cache_size = 64
\ No newline at end of file
baseimg/tools/db5.7/mysqld_charset.cnf
0 → 100644
View file @
2f3a2069
[mysqld]
character_set_server=utf8
character_set_filesystem=utf8
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'
init_connect='SET collation_connection = utf8_general_ci'
skip-character-set-client-handshake
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment