Percona XtraDB Cluster 5.6 does not start - mysql

All the good days. I want to run for test purposes Percona XtraDb Cluster on ubuntu 14.04. The basis here took these two articles
https://habrahabr.ru/post/152969/
https://www.percona.com/doc/percona-xtradb-cluster/5.6/manual/bootstrap.html
I came instead
Ну и в завершение, перезапускаем демона:
The daemon does not start
$ sudo /etc/init.d/mysql start
* Starting MySQL (Percona XtraDB Cluster) database server mysqld
* The server quit without updating PID file (/var/lib/mysql/vagrant-ubuntu-trusty-64.pid).
...fail!
The logs several errors. Error one:
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Sure I ran mysql_upgrade, but it does not work
$ sudo mysql_upgrade
Looking for 'mysql' as: mysql Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed
Error two:
160502 14:56:26 [ERROR] Plugin 'InnoDB' init function returned error.
160502 14:56:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE
ENGINE failed. 160502 14:56:26 [ERROR] Unknown/unsupported storage
engine: InnoDB 160502 14:56:26 [ERROR] Aborting
All are advised to remove all of the folders / var / lib / mysql and supposedly starts. But I deleted and nothing worked.
My file my.cnf
[mysqld_safe]
# wsrep_urls=gcomm://192.168.33.101:3400,gcomm://192.168.33.102:3400,gcomm://
#wsrep_urls=gcomm://192.168.33.101:3400,gcomm://
[mysqld]
innodb_log_file_size=256M
wsrep_cluster_address=gcomm://192.168.33.101
port=3306
socket=/var/run/mysqld/mysqld.sock
datadir=/var/lib/mysql
basedir=/usr
user=mysql
log_error=/var/log/mysql.err
binlog_format=ROW
default_storage_engine=InnoDB
wsrep_provider=/usr/lib/libgalera_smm.so
wsrep_sst_receive_address=192.168.33.101:3500
wsrep_node_incoming_address=192.168.33.101
wsrep_slave_threads=2
wsrep_cluster_name=cluster0
wsrep_provider_options="gmcast.listen_addr=tcp://192.168.33.101:3400;"
wsrep_sst_method=xtrabackup
wsrep_sst_auth=backup:password
wsrep_node_name=node0
innodb_locks_unsafe_for_binlog=1
innodb_autoinc_lock_mode=2
innodb_buffer_pool_size=5000M
innodb_log_file_size=256M
innodb_log_buffer_size=4M
[client]
port=3306
socket=/var/run/mysqld/mysqld.sock
Actually the question: how to start? If there is anyone working configuration, then please share.

For the record:
Percona is amazing, but highly undocumented.
When it comes to configuring it, ive learned less is better.
important parts:
server-id required
these may be braking it, in my experience.
wsrep_sst_receive_address=192.168.33.101:3500
wsrep_node_incoming_address=192.168.33.101
Config from my cluster:
[mysqld]
server-id=18
datadir=/var/lib/mysql
wsrep_provider=/usr/lib/libgalera_smm.so
# Cluster connection URL -|-node0, -|-node1, -|-node2 -|-node3 -|-node4 -|-node5 -|-node6 -|-node7 -|-node8
wsrep_cluster_address=gcomm://192.168.1.18,192.168.1.19,192.168.1.20 #removed some
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_sst_method=rsync
wsrep_sst_auth="root:password"
wsrep_cluster_name=grapes
innodb_buffer_pool_size=5140
innodb_buffer_pool_instances=4
innodb_flush_log_at_trx_commit=0
query_cache_size=0

Related

MySQL NOFILE limits on WSL2

I am running MySQL on WSL2 for Windows. At WSL2 startup, MySQL does not start and I get the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I then run this command to get it going:
sudo service mysql start
And get the following output:
* Starting MySQL database server mysqld
su: warning: cannot change directory to /nonexistent: No such file or directory
[ OK ]
When I check my MySQL error logs, I see this error regarding max_open_files and table_open_cache:
2022-07-28T08:36:34.074107Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2022-07-28T08:36:34.074111Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
My understanding is I need to edit my /lib/systemd/system/mysql.service file to change this, but when I check that file I see that LimitNOFILE is already set to 10000
# MySQL systemd service file
[Unit]
Description=MySQL Community Server
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
Type=notify
User=mysql
Group=mysql
PIDFile=/run/mysqld/mysqld.pid
PermissionsStartOnly=true
ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
ExecStart=/usr/sbin/mysqld
TimeoutSec=infinity
Restart=on-failure
RuntimeDirectory=mysqld
RuntimeDirectoryMode=755
LimitNOFILE=10000
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart.
Environment=MYSQLD_PARENT_PID=1
It's almost as if that setting get's ignored at service startup? Does anyone know where the right place is to set it if this isn't?
You need to check information in /etc/security/limits.conf
You can add something like (assuming you run mysqld as mysql user)
mysql hard nofile 10000
mysql soft nofile 8192
and in my.cnf
[mysqld]
open_files_limit = 10000
table_open_cache=4096
then logout, login and restart mysql

percona xtradb cluster mysql startup error

i have 2 nodes to prepare percona xtradb cluster , i have successfully installed the applications . then I tried to configure the file my.cnf
NODE1 :
cat >>/etc/my.cnf<<EOF
[mysqld]
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=democluster
wsrep_cluster_address=gcomm://192.168.254.126,192.168.254.127
wsrep_node_name=centosvm02
wsrep_node_address=192.168.254.126
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=uertest:123abc#A
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
EOF
NODE 2 :
cat >>/etc/my.cnf<<EOF
[mysqld]
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=democluster
wsrep_cluster_address=gcomm://192.168.254.126,192.168.254.127
wsrep_node_name=centosvm02
wsrep_node_address=192.168.254.127
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=uertest:123abc#A
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
EOF
after config is done i started systemctl start mysql#bootstrap but it failed. I discovered an error on startup
enter image description here
The error message is quite clear. The needed library cannot be found. If you installed PXC 8, then the library is galera4, not galera3. Make sure you installed all appropriate packages.

Unable to start mysql after restarting server

I restarted server where mysql is installed since then it is not getting started below is the error log i got when the try to start mysqld service.I checked whether any mysqld_safe is running using ps ax | grep mysql seems nothing is running
160506 08:54:53 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160506 08:54:59 mysqld_safe Starting mysqld daemon with databases from /data/mysql
160506 8:54:59 [ERROR] /usr/libexec/mysqld: ambiguous option '--i' (ignore-builtin-innodb, interactive_timeout)
160506 8:54:59 [ERROR] Aborting
160506 08:54:59 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
My.cnf
[mysqld]
server-id=832
#datadir=/var/lib/mysql
#datadir=/database/mysql/data
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
lower_case_table_names=1
max_connections=2048
#check
# this happens when max_allowed_packet=1M but not when max_allowed_packet=2M,
i# actually 1638400 is already fine
max_allowed_packet=1024M
key_buffer=128M
max_user_connections=32768
tmp_table_size=128M
table_cache=524288 # old value is 1024M
query_cache_size=512M
query_cache_type=1
sort_buffer=128M
join_buffer_size=32M
read_buffer=128M
#set-variable = write_buffer=128M Timeout occurs if opened this
#record_buffer=128M old parameter please use read_buffer_size instead
read_buffer_size=512M # old value is 128M
myisam_sort_buffer_size=64M
myisam_max_sort_file_size=2G
back_log=100
interactive_timeout=10000
wait_timeout=1000
connect_timeout=1000
net_read_timeout=1000
open_files_limit=30000
thread_concurrency=512
thread_cache_size=16384 #old value is 128M
thread_stack=8M
#end of check
## extra parameters verify and remove
#TransactionDeadlockDetectionTimeout=100 Notworking
#HeartbeatIntervalDbDb=3000
#HeartbeatIntervalDbApi=3000
#innodb_buffer_pool_size=4096M
innodb_buffer_pool_size=1G
innodb_additional_mem_pool_size=512M
innodb_thread_concurrency=0
innodb_file_per_table=1
sort_buffer=128M
#log_slow_queries=ON
slow_query_log=/database/mysql/log/slowlog
max_sp_recursion_depth=5
## upto Here
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Re-installing mysql binaries does the job for me

Missing mysql.sock file. phpMyAdmin - Fedora 17

I run Fedora 17 with "Webadmin". So I tried to use webadmin option to update upload maximum size to my MySQL database. Now, I not able to restart mysqld. I have no GUI, so when run systemctl status mysqld.service I gives me this message:
[root#localhost ~]# systemctl status mysqld.service
mysqld.service - MySQL database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: failed (Result: exit-code) since Mon, 30 Jul 2012 15:08:26 -0400; 6min ago
Process: 3560 ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 3559 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 3542 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/mysqld.service
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Logging to '/var/log/mysqld.log'.
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
or when I try to access my phpmyadmin screen i see this message:
phpMyAdmin - Error
#2002 - Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The server is not responding (or the local server's socket is not correctly configured).
When I run in terminal locate mysql.sock it shows the correct path /var/lib/mysql/mysql.sock.
But when I run this command ls /var/lib/mysql, I not able to locate this file.
Please help.
After punching my monitor and kicking my server I was able to find a fix. Not sure how safe or good at is, but it works to me.
In terminal open up your my.cnf file # nano /etc/my.cnf
Delete or just comment all existing settings with '#', then just paste this code that I found on http://blog.mclaughlinsoftware.com/2011/12/07/fixing-my-cnf-on-fedora/
[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# Default directory.
datadir=/var/lib/mysql
# The TCP/IP Port the MySQL Server listens on.
port=3306
# The Linux Socket the MySQL Server uses when not using a listener.
# socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# The default storage engine that will be used when creating new tables.
default-storage-engine=INNODB
# Set the SQL mode to strict.
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# Set the maximum number of connections.
max_connections=100
# Set the number of open tables for all threads.
table_cache=256
# Set the maximum size for internal (in-memory) temporary tables.
tmp_table_size=26M
# Set how many threads should be kept in a cache for reuse.
thread_cache_size=8
# MyISAM configuration.
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=52M
key_buffer_size=36M
read_rnd_buffer_size=256K
sort_buffer_size=256K
# InnoDB configuration.
innodb_data_home_dir=/var/lib/mysql
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=25M
innodb_log_file_size=5M
innodb_thread_concurrency=8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Open for any comments or suggestions.
Thank you.

Starting MySQL.Manager of pid-file quit without updating fi error

I am getting following error while starting mysql ...can someone help:
]# service mysql start
Starting MySQL.Manager of pid-file quit without updating fi[FAILED]
Following is my my.cnf file...
** my.cnf file *****
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
table_cache = 2048
innodb_buffer_pool_size = 2G
innodb_file_per_table
innodb_log_buffer_size = 8M
innodb_log_file_size = 128M
innodb_additional_mem_pool_size = 4M
innodb_table_locks = 0
default-storage-engine=InnoDB
join_buffer_size = 2M
query_cache_size = 512M
query_cache_limit = 2M
sort_buffer_size = 8M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
key_buffer = 512M
key_buffer_size = 256M
max_allowed_packet = 16M
max_connections = 250
long_query_time = 5
log_slow_queries = ekb-qa-app-02-slow.log
innodb_autoinc_lock_mode=2
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
I received the exact same error...which ended up being misleading to me. The problem (at least for me) ended up being that I had filled the disk to capacity. Try df -h and see if you are at capacity. Hope that helps, and that this error was caused by this as well for you ( since it is simple to fix :) ).
This can be happen due to two reasons:
mysqld is trying to write logs to the disk, which is full.
mysqld is trying to write logs to the file but it doesn't have appropriate permissions.
Try running the mysqld_safe directly and see if the error message is more specific about your problem. This way I was able to realize the my log file had a permissions problem.
For me, the issue was insufficient privileges to the mysql data files. The data files were copied over from another file system as root. Once I changed the group and ownership of the files to mysql:mysql the error went away.
The /etc/init.d/mysql[d] startup script can also outsmart itself by printing overlapping error messages, but you only end up seeing one. You may also see "[FAILED]" or "[OK]" overlapping in the middle of the script output, and some of this may even depend on the exact terminal software you use.
Meanwhile, in my case, the true error was buried underneath this:
Manager of pid-file quit wi[FAILED]dating file
I finally looked closely enough at my mysqld error log, and found the real issue:
/usr/sbin/mysqld: File 'MASTER/master15-bin.index' not found (Errcode: 2)
Like other similar cases here, the problem came from copying the whole /var/lib/mysql directory over from a different host. Here I was setting up a fresh replication server, and so the MASTER and SLAVE variables are different in /etc/my.cnf of course. My master binlogs are in a MASTER subdirectory.
Once I cleaned that up, everything was fine.
So this "Manager of pid-file quit" error was another red herring. I'm just adding this story here to show yet again that (1) the answer probably lies in your error log, and (2) may have nothing to do with this error you see from mysqld_safe.
I just prefix sudo command in the below statement and mysql started.
$ sudo /etc/rc.d/init.d/mysql start
Input password:
Starting MySQL.
I checked and found that MySQL is running by issuing below command:
$ mysqladmin -u root -pjoomla1 ping
mysqld is alive
For me the issue was with multiple my.cnf file put in server , removing one of it(wrong file) helped me resolve the issue
If you have mysql on it's own partition (such as /var/lib/mysql), make sure that it hasn't gone read-only. to do this, attempt to create (touch) a file in that partition. if it has gone read-only, it will let you know and you will need to run a manual fsck on that partition. first make sure there are no running processes ( lsof /var/lib/mysql | awk '{print $1}'|sort|uniq -c|awk '{print $2}') then umount the partition before fscking it.
here's what I noticed after playing with my.cnf config file to try optimum performance.
If I set innodb_log_file_size to a wrong value and I try restarting the mysql server, it shuts down ok, but when it tries to start, I get something similar to the following:
Starting MySQL.The server quit without updating PID file ([FAILED]mysql/<insert pid file here>).
Then when I checked the error log to find out whats going on, I saw all this:
140709 22:47:30 mysqld_safe mysqld from pid file /var/lib/mysql/<pid filename>.pid ended
140709 22:47:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140709 22:47:31 [Warning] Using unique option prefix thread_cache instead of thread_cache_size is deprecated and will be removed...
140709 22:47:31 [Note] Plugin 'FEDERATED' is disabled.
140709 22:47:31 InnoDB: The InnoDB memory heap is disabled
140709 22:47:31 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140709 22:47:31 InnoDB: Compressed tables use zlib 1.2.3
140709 22:47:31 InnoDB: Using Linux native AIO
140709 22:47:31 InnoDB: Initializing buffer pool, size = 512.0M
140709 22:47:31 InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 67108864 bytes!
140709 22:47:31 [ERROR] Plugin 'InnoDB' init function returned error.
140709 22:47:31 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140709 22:47:31 [ERROR] Unknown/unsupported storage engine: InnoDB
140709 22:47:31 [ERROR] Aborting
140709 22:47:31 [Note] /usr/sbin/mysqld: Shutdown complete
140709 22:47:31 mysqld_safe mysqld from pid file /var/lib/mysql/<pid filename>.pid ended
Except that I replaced the pid filename with "pid filename".
Websites think you can set innodb_log_file_size to a value but something is trying to tell me that it is a value that the mysql server calculates and its something you can't set.
This suggestion will HELP also.
REMOVE the following list so DEFAULTS can support your effort from [mysqld] section of my.cnf/.ini
sort_buffer_size
read_buffer_size
read_rnd_buffer_size
join_buffer_size
to improve(reduce) response time.
Why would you intentionally read 16M of read_rnd_buffer_size data when you could get the data you need with the DEFAULT of 256K ?
i think it will fix via hash
query_cache
you didn't mention what system are you using here. For CentOS, Fedora, and Red Hat Enterprise Linux, use service mysqld instead of mysql
sudo /etc/init.d/mysqld start
I believe the issue might be with the variable "performance_schema" found within your my.cnf file. This variable should be commented out. Give it a try.