From 5272463689bfef04d243252d119ae5127473ab35 Mon Sep 17 00:00:00 2001 From: Ye Jinrong Date: Wed, 13 Jul 2022 14:50:09 +0800 Subject: [PATCH 1/3] update --- greatsql.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/greatsql.yml b/greatsql.yml index b5dfbf2..c09a35f 100644 --- a/greatsql.yml +++ b/greatsql.yml @@ -30,8 +30,8 @@ - name: create data_dir file: path={{data_dir}} state=directory owner={{mysql_user}} group={{mysql_user}} mode=0700 -# - name: extract GreatSQL tarball -# unarchive: src={{work_dir}}/{{file_name}} dest={{extract_dir}} mode=755 + - name: extract GreatSQL tarball + unarchive: src={{work_dir}}/{{file_name}} dest={{extract_dir}} mode=755 - name: backup /etc/my.cnf copy: src={{my_cnf}} dest={{my_cnf}}.orig ignore_errors=True -- Gitee From 781893e0ec21bd572cc01e4524c98b50a869de8f Mon Sep 17 00:00:00 2001 From: Ye Jinrong Date: Wed, 13 Jul 2022 16:54:49 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89datadir=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql-support-files/my.cnf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-support-files/my.cnf b/mysql-support-files/my.cnf index 30502b9..1dc3860 100644 --- a/mysql-support-files/my.cnf +++ b/mysql-support-files/my.cnf @@ -11,7 +11,7 @@ port = 3306 server_id = 3306 basedir = /usr/local/GreatSQL-8.0.25-16-Linux-glibc2.28-x86_64 datadir = /data/GreatSQL -socket = /data/GreatSQL/mysql.sock +socket = mysql.sock pid-file = mysql.pid character-set-server = UTF8MB4 skip_name_resolve = 1 @@ -40,18 +40,18 @@ max_heap_table_size = 32M #log settings log_timestamps = SYSTEM -log_error = /data/GreatSQL/error.log +log_error = error.log log_error_verbosity = 3 slow_query_log = 1 log_slow_extra = 1 -slow_query_log_file = /data/GreatSQL/slow.log +slow_query_log_file = slow.log long_query_time = 0.1 log_queries_not_using_indexes = 1 log_throttle_queries_not_using_indexes = 60 min_examined_row_limit = 100 log_slow_admin_statements = 1 log_slow_slave_statements = 1 -log_bin = /data/GreatSQL/binlog +log_bin = binlog binlog_format = ROW sync_binlog = 1 binlog_cache_size = 4M -- Gitee From e7f5a4a062201d5ac1083c07bf063a9c74ba75b3 Mon Sep 17 00:00:00 2001 From: Ye Jinrong Date: Wed, 13 Jul 2022 16:55:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AE=8C=E5=96=84ansible=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AF=B9=E5=90=84=E7=A7=8D=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E7=9A=84=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- greatsql.yml | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/greatsql.yml b/greatsql.yml index c09a35f..1a213bd 100644 --- a/greatsql.yml +++ b/greatsql.yml @@ -72,18 +72,60 @@ regexp: '(.*report_host.*)=.*' replace: '\1= {{ inventory_hostname }}' + - name: replace my.cnf basedir + replace: + path: "{{ my_cnf }}" + regexp: 'basedir.*' + replace: 'basedir = {{ base_dir }}' + + - name: replace my.cnf datadir + replace: + path: "{{ my_cnf }}" + regexp: 'datadir.*' + replace: 'datadir = {{ data_dir }}' + + - name: replace my.cnf user + replace: + path: "{{ my_cnf }}" + regexp: '^user.*' + replace: 'user = {{ mysql_user }}' + + - name: replace my.cnf port + replace: + path: "{{ my_cnf }}" + regexp: '^port.*' + replace: 'port = {{ mysql_port }}' + - name: copy sysconfig/mysql to /etc/sysconfig/mysql copy: src={{work_dir}}/mysql-support-files/sysconfig/mysql dest=/etc/sysconfig owner=root group=root mode=0644 - name: preload jemalloc command: /usr/sbin/ldconfig - + - name: copy mysql PATH copy: src={{work_dir}}/mysql-support-files/mysql.sh dest=/etc/profile.d/mysql.sh + - name: replace mysql.sh PATH + replace: + path: /etc/profile.d/mysql.sh + regexp: '(.*PATH.*)=.*' + replace: 'export PATH=$PATH:{{base_dir}}/bin' + - name: copy greatsql.server copy: src={{work_dir}}/mysql-support-files/greatsql.service dest=/usr/lib/systemd/system/ owner=root group=root mode=0644 + - name: replace greatsql.service + replace: + path: /usr/lib/systemd/system/greatsql.service + regexp: '(ExecStartPre=)(.*)(/bin/mysqld.*)' + replace: '\1{{base_dir}}\3' + + - name: replace greatsql.service + replace: + path: /usr/lib/systemd/system/greatsql.service + regexp: '(ExecStart=)(.*)(/bin/mysqld.*)' + replace: '\1{{base_dir}}\3' + - name: reload GreatSQL service command: /usr/bin/systemctl daemon-reload -- Gitee