Skip to content

Commit af49e9e

Browse files
authored
Updates
1 parent feb4947 commit af49e9e

4 files changed

Lines changed: 34 additions & 12 deletions

File tree

config/etc/mysql/my.cnf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ default-storage-engine = InnoDB
3434
performance_schema = OFF
3535

3636
# Skip reverse DNS lookup of clients
37-
skip-name-resolve
37+
skip-name-resolve = ON
3838

3939
bind-address = 127.0.0.1
4040

@@ -103,9 +103,9 @@ max_binlog_size = 100M
103103

104104
# * InnoDB
105105
default_storage_engine = InnoDB
106-
innodb_log_file_size = SEDMYSQL10PERCENTM
107-
innodb_buffer_pool_size = SEDMYSQL45PERCENTM
108-
innodb_log_buffer_size = SEDLBSM
106+
innodb_log_file_size = SEDMYSQL09PERCENT
107+
innodb_buffer_pool_size = SEDMYSQL43PERCENT
108+
innodb_log_buffer_size = SEDLBS
109109
innodb_open_files = SEDINOF
110110
innodb_io_capacity = SEDAVGIOPS
111111
innodb_io_capacity_max = SEDMAXIOPS

scripts/functions/server-tools/mysqltuner.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,28 @@ source /usr/local/bin/enginescript/scripts/functions/shared/enginescript-common.
1818
#----------------------------------------------------------------------------------
1919
# Start Main Script
2020

21-
perl /usr/local/bin/mysqltuner/mysqltuner.pl
21+
# CVE vulnerabilities CSV file used by MySQLTuner for exploit scanning
22+
CVE_FILE="/usr/local/bin/mysqltuner/vulnerabilities.csv"
23+
24+
# Ensure CVE file exists and is reasonably up-to-date (update if older than 7 days)
25+
if [ ! -f "${CVE_FILE}" ] || [ $(( $(date +%s) - $(stat -c %Y "${CVE_FILE}" 2>/dev/null || echo 0) )) -gt $((7 * 24 * 60 * 60)) ]; then
26+
echo "Updating MySQLTuner CVE database..."
27+
mkdir -p "$(dirname "${CVE_FILE}")"
28+
if wget -q -O "${CVE_FILE}" https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv --no-check-certificate; then
29+
chmod 644 "${CVE_FILE}" 2>/dev/null || true
30+
echo "Vulnerabilities CVE database updated: ${CVE_FILE}"
31+
else
32+
echo "Warning: Failed to download vulnerabilities.csv; continuing without CVE scan" >&2
33+
fi
34+
fi
35+
36+
# Run MySQLTuner with CVE exploit scanning enabled (if file present)
37+
if [ -f "${CVE_FILE}" ]; then
38+
echo "Running MySQLTuner with CVE scanning enabled (using ${CVE_FILE})..."
39+
perl /usr/local/bin/mysqltuner/mysqltuner.pl --cvefile="${CVE_FILE}"
40+
else
41+
perl /usr/local/bin/mysqltuner/mysqltuner.pl
42+
fi
2243

2344
# Ask user to acknowledge that the scan has completed before moving on
2445
echo ""

scripts/install/mariadb/mariadb-tune.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ Environment="_WSREP_NEW_CLUSTER="
3939
EOF
4040

4141
# Set Memory Variables
42-
SERVER_MEMORY_TOTAL_45="$(free -m | awk 'NR==2{printf "%d", $2*0.45 }')"
42+
SERVER_MEMORY_TOTAL_43="$(free -m | awk 'NR==2{printf "%d", $2*0.43 }')"
4343
SERVER_MEMORY_TOTAL_13="$(free -m | awk 'NR==2{printf "%d", $2*0.13 }')"
4444

4545
# Log Buffer Size variable calculation
4646
if [[ "${SERVER_MEMORY_TOTAL_80}" -lt 4000 ]];
4747
then
48-
SEDLBSM="32M"
48+
SEDLBS="32"
4949
else
50-
SEDLBSM="64M"
50+
SEDLBS="64"
5151
fi
5252

5353
# tmp_table_size & max_heap_table_size
@@ -66,7 +66,7 @@ if [[ "${SERVER_MEMORY_TOTAL_80}" -lt 4000 ]];
6666
fi
6767

6868
# Use the calculated SEDLBSM variable for log buffer size
69-
sed -i "s|SEDLBSM|${SEDLBSM}|g" /etc/mysql/my.cnf
69+
sed -i "s|SEDLBS|${SEDLBS}M|g" /etc/mysql/my.cnf
7070

7171
if [[ "${SERVER_MEMORY_TOTAL_80}" -lt 4000 ]];
7272
then
@@ -114,10 +114,10 @@ sed -i "s|SEDMYSQL03PERCENT|${SERVER_MEMORY_TOTAL_03}|g" /etc/mysql/my.cnf
114114
if [[ "${SERVER_MEMORY_TOTAL_10}" -gt 512 ]]; then
115115
SERVER_MEMORY_TOTAL_10=512
116116
fi
117-
sed -i "s|SEDMYSQL10PERCENT|${SERVER_MEMORY_TOTAL_10}|g" /etc/mysql/my.cnf
117+
sed -i "s|SEDMYSQL09PERCENT|${SERVER_MEMORY_TOTAL_09}M|g" /etc/mysql/my.cnf
118118

119119
sed -i "s|SEDMYSQL13PERCENT|${SERVER_MEMORY_TOTAL_13}|g" /etc/mysql/my.cnf
120-
sed -i "s|SEDMYSQL45PERCENT|${SERVER_MEMORY_TOTAL_45}|g" /etc/mysql/my.cnf
120+
sed -i "s|SEDMYSQL43PERCENT|${SERVER_MEMORY_TOTAL_43}M|g" /etc/mysql/my.cnf
121121
sed -i "s|SEDMYSQL80PERCENT|${SERVER_MEMORY_TOTAL_80}|g" /etc/mysql/my.cnf
122122

123123
# IOPS Benchmark
@@ -161,4 +161,4 @@ systemctl daemon-reload
161161

162162
# References:
163163
# https://linuxblog.io/innodb_flush_method-innodb_flush_log_at_trx_commit-optimizing-mysql/
164-
# https://www.percona.com/blog/2018/01/31/how-to-tune-mariadb-10-3-for-high-performance/
164+
# https://www.percona.com/blog/2018/01/31/how-to-tune-mariadb-10-3-for-high-performance/

scripts/install/tools/mysql/mysqltuner.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ wget -O /usr/local/bin/mysqltuner/mysqltuner.pl https://raw.githubusercontent.co
2424
wget -O /usr/local/bin/mysqltuner/basic_passwords.txt https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt --no-check-certificate
2525
wget -O /usr/local/bin/mysqltuner/vulnerabilities.csv https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv --no-check-certificate
2626
chmod +x /usr/local/bin/mysqltuner/mysqltuner.pl
27+
chmod 644 /usr/local/bin/mysqltuner/vulnerabilities.csv
2728

2829
echo ""
2930
echo ""

0 commit comments

Comments
 (0)