Location>code7788 >text

LINUX manually install Wanli open source single instance

Popularity:973 ℃/2025-02-12 11:29:33

Download the installation package

/GreatSQL/GreatSQL/releases/

Close selinux and firewall

#Close selinux
 $ setenforce=0
 $ sed -i '/^SELINUX=/c'SELINUX=disabled /etc/selinux/config

 #Close the firewall
 $ systemctl disable firewalld
 $ systemctl stop firewalld
 $ systemctl disable iptables
 $ systemctl stop iptables

Download the binary package and install it

Place the downloaded binary package in the installation directory /usr/local/ and unzip:

# download
 $ cd /usr/local
 $ wget wget /GreatSQL-8.0.32-26/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64.
 #or use curl
 $ curl -o GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64. /GreatSQL-8.0.32-26/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64.

 #Decompress
 $tar xf GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64.

Edit the systemd system service file and add the GreatSQL service file: be sure to confirm whether the directory and file name in the file are correct.

vi /usr/lib/systemd/system/

[Unit]
Description=GreatSQL Server
Documentation=man:mysqld(8)
Documentation=/doc/refman/en/
After=
After=
[Install]
WantedBy=
[Service]
User=mysql
Group=mysql
Type=notify
TimeoutSec=0
PermissionsStartOnly=true
ExecStartPre=/usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64/bin/mysqld_pre_systemd
ExecStart=/usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64/bin/mysqld $MYSQLD_OPTS
EnvironmentFile=-/etc/sysconfig/mysql
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
Environment=MYSQLD_PARENT_PID=1
PrivateTmp=false

Execute the command to overload systemd and join the greatsql service. If there is no problem, there will be no error:

This will successfully install and add GreatSQL to the system service. You can use systemctl to manage the GreatSQL service later.

systemctl daemon-reload

Edit the GreatSQL global configuration file /etc/, add the following content and save and exit

[mysqld]
 user = mysql
 port = 3306
 server_id = 3306
 basedir=/usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64
 datadir = /data/GreatSQL
 socket = /data/GreatSQL/
 pid-file =
 character-set-server = UTF8MB4
 skip_name_resolve = 1
 #If your MySQL database is mainly running abroad, please be sure to adjust this parameter according to the actual situation
 default_time_zone = "+8:00"

 #performance settings
 lock_wait_timeout = 3600
 open_files_limit = 65535
 back_log = 1024
 max_connections = 512
 max_connect_errors = 1000000
 table_open_cache = 1024
 table_definition_cache = 1024
 thread_stack = 512K
 sort_buffer_size = 4M
 join_buffer_size = 4M
 read_buffer_size = 8M
 read_rnd_buffer_size = 4M
 bulk_insert_buffer_size = 64M
 thread_cache_size = 768
 interactive_timeout = 600
 wait_timeout = 600
 tmp_table_size = 32M
 max_heap_table_size = 32M

 #log settings
 log_timestamps = SYSTEM
 log_error = /data/GreatSQL/
 log_error_verbosity = 3
 slow_query_log = 1
 log_slow_extra = 1
 slow_query_log_file = /data/GreatSQL/
 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
 binlog_format = ROW
 sync_binlog = 1
 binlog_cache_size = 4M
 max_binlog_cache_size = 2G
 max_binlog_size = 1G
 binlog_rows_query_log_events = 1
 binlog_expire_logs_seconds = 604800
 Before #MySQL 8.0.22, if you want to enable MGR, you need to set binlog_checksum=NONE
 binlog_checksum = CRC32
 gtid_mode = ON
 enforce_gtid_consistency = TRUE

 #myisam settings
 key_buffer_size = 32M
 myisam_sort_buffer_size = 128M

 #replication settings
 master_info_repository = TABLE
 relay_log_info_repository = TABLE
 relay_log_recovery = 1
 slave_parallel_type = LOGICAL_CLOCK
 # Can be set to 2 times the number of logical CPUs
 slave_parallel_workers = 64
 binlog_transaction_dependency_tracking = WRITESET
 slave_preserve_commit_order = 1
 slave_checkpoint_period = 2

 #mgr settings
 loose-plugin_load_add = 'mysql_clone.so'
 loose-plugin_load_add = 'group_replication.so'
 loose-group_replication_group_name = "aaaaaaa-aaaaa-aaaaa-aaaaa-aaaaaaaaaaaaa1"
 #MGR local node IP:PORT, please replace it yourself
 loose-group_replication_local_address = "172.16.16.10:33061"
 #MGR cluster IP:PORT, please replace it yourself
 loose-group_replication_group_seeds = "172.16.16.10:33061,172.16.16.11:33061,172.16.16.12:33061"
 loose-group_replication_start_on_boot = OFF
 loose-group_replication_bootstrap_group = OFF
 loose-group_replication_exit_state_action = READ_ONLY
 loose-group_replication_flow_control_mode = "DISABLED"
 loose-group_replication_single_primary_mode = ON

 #innodb settings
 transaction_isolation = REPEATABLE-READ
 innodb_buffer_pool_size = 2G
 innodb_buffer_pool_instances = 8
 innodb_data_file_path = ibdata1:12M:autoextend
 innodb_flush_log_at_trx_commit = 1
 innodb_log_buffer_size = 32M
 innodb_log_file_size = 1G
 innodb_log_files_in_group = 3
 innodb_max_undo_log_size = 4G
 #Adjust adjust according to your server IOPS capabilities
 # If you are generally equipped with a normal SSD disk, you can adjust it to 10000 - 20000
 # If you configure a high-end PCIe SSD card, you can adjust it higher, such as 50000 - 80000
 innodb_io_capacity = 4000
 innodb_io_capacity_max = 8000
 innodb_open_files = 65535
 innodb_flush_method = O_DIRECT
 innodb_lru_scan_depth = 4000
 innodb_lock_wait_timeout = 10
 innodb_rollback_on_timeout = 1
 innodb_print_all_deadlocks = 1
 innodb_online_alter_log_max_size = 4G
 innodb_print_ddl_logs = 1
 innodb_status_file = 1
 #Note: Turn on innodb_status_output & innodb_status_output_locks, the log_error file may grow faster
 innodb_status_output = 0
 innodb_status_output_locks = 1
 innodb_sort_buffer_size = 67108864

 #innodb monitor settings
 innodb_monitor_enable = "module_innodb"
 innodb_monitor_enable = "module_server"
 innodb_monitor_enable = "module_dml"
 innodb_monitor_enable = "module_ddl"
 innodb_monitor_enable = "module_trx"
 innodb_monitor_enable = "module_os"
 innodb_monitor_enable = "module_purge"
 innodb_monitor_enable = "module_log"
 innodb_monitor_enable = "module_lock"
 innodb_monitor_enable = "module_buffer"
 innodb_monitor_enable = "module_index"
 innodb_monitor_enable = "module_ibuf_system"
 innodb_monitor_enable = "module_buffer_page"
 innodb_monitor_enable = "module_adaptive_hash"

 #pfs settings
 performance_schema = 1
 #performance_schema_instrument = '%memory%=on'
 performance_schema_instrument = '%lock%=on'

Create a mysql system user:

$ /sbin/groupadd mysql
$ /sbin/useradd -g mysql mysql -d /dev/null -s /sbin/nologin

Create relevant folders and modify the user group (change /usr/local/GreatSQL-8.0.32-25-Linux-glibc2.28-x86_64/ in the file to the actual installation directory):

mkdir /var/run/mysqld/ /var/lib/mysql-files/ /var/lib/mysql/ 

chown mysql:mysql /var/run/mysqld/ /var/lib/mysql-files/ /var/lib/mysql/ /usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64/

Start GreatSQL

Run the following command to start the GreatSQL service

systemctl start greatsql

Check whether the service has been started and the process status:

[root@192 data]# systemctl status greatsql
 ● - GreatSQL Server
    Loaded: loaded (/usr/lib/systemd/system/; disabled; vendor preset: disabled)
    Active: active (running) since Sun 2025-02-09 18:43:14 CST; 45min ago
      Docs: man:mysqld(8)
            /doc/refman/en/
  Main PID: 31673 (mysqld)
    Status: "Server is operational"
     Tasks: 54 (limit: 100480)
    Memory: 639.4M
    CGroup: //
            └─31673 /usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64/bin/mysqld

 February 09 18:42:58 192.168.188.23 systemd[1]: Starting GreatSQL Server...
 February 09 18:43:14 192.168.188.23 systemd[1]: Started GreatSQL Server.
 [root@192 data]# ps -ef | grep mysqld
 mysql 31673 1 0 18:42 ? 00:00:13 /usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64/bin/mysqld
 root 32664 1646 0 19:28 pts/0 00:00:00 grep --color=auto mysqld
 [root@192 data]# ss -lntp | grep mysqld
 LISTEN 0 70 *:33060 *:* users:(("mysqld",pid=31673,fd=46))
 LISTEN 0 1024 *:3306 *:* users:(("mysqld",pid=31673,fd=51))
 #View data files
 [root@192 data]# ls /data/GreatSQL
          binlog.000004 '#file_purge' '#ib_16384_12.dblwr' '#ib_16384_1.dblwr' '#ib_16384_5.dblwr' '#ib_16384_9.dblwr' '#innodb_redo' performance_schema undo_002
  binlog.000001 binlog.000005 '#ib_16384_0.dblwr' '#ib_16384_13.dblwr' '#ib_16384_2.dblwr' '#ib_16384_6.dblwr' ib_buffer_pool innodb_status.31673 private_key.pem
  binlog.000002 '#ib_16384_10.dblwr' '#ib_16384_14.dblwr' '#ib_16384_3.dblwr' '#ib_16384_7.dblwr' ibdata1 '#innodb_temp' public_key.pem sys
  binlog.000003 '#ib_16384_11.dblwr' '#ib_16384_15.dblwr' '#ib_16384_4.dblwr' '#ib_16384_8.dblwr' ibtmp1 mysql undo_001
 [root@192 data]#

As you can see, the GreatSQL service has been started normally.

Connect to GreatSQL

After installing GreatSQL using the minimum binary package, check the initialization password through the log-error log and log in.

$ cat /var/log/|grep password
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: NrkNcJya<9f6

If you use the recommended GreatSQL, the error log path will change. Please use the following command to view the initialization password.

$ $ grep -i root /data/GreatSQL/
... A temporary password is generated for root@localhost: ji!pjndiw5sJ

Copy your password to log in to GreatSQL

/usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64/bin/mysql -uroot -p'ji!pjndiw5sJ'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.32-26 GreatSQL, Release 26, Revision a68b3034c3d

Copyright (c) 2021-2024 GreatDB Software Co., Ltd
Copyright (c) 2009-2024 Percona LLC and/or its affiliates
Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> 
mysql> 
mysql> 
mysql> \s
--------------
/usr/local/GreatSQL-8.0.32-26-Linux-glibc2.17-x86_64/bin/mysql  Ver 8.0.32-26 for Linux on x86_64 (GreatSQL, Release 26, Revision a68b3034c3d)

Connection id:          22
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         8.0.32-26 GreatSQL, Release 26, Revision a68b3034c3d
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:            /tmp/
Binary data as:         Hexadecimal
Uptime:                 59 min 16 sec

Threads: 4  Questions: 71  Slow queries: 2  Opens: 255  Flush tables: 3  Open tables: 172  Queries per second avg: 0.019
--------------

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql> 

Login error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/' (2)

Solution: Create a soft connection to the sock file used by mysql
 ln -s /data/GreatSQL/ /tmp/

Login error: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Solution: Realize password-free login
 /etc/ Add skip-grant-tables
 Then restart the database: systemctl restart greatsql

Modify password

ALTER USER 'root'@'%' IDENTIFIED BY 'passwd';
FLUSH PRIVILEGES;

Realize remote login

update user set host = '%' where user = 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'  WITH GRANT OPTION;
FLUSH PRIVILEGES;