Laravel Sail starting error related to MySQL on Ububtu 22 - php

I added Sail to a current Laravel project
composer require laravel/sail --dev
php artisan sail:install
but when I run ./vendor/bin/sail up I get MySQL error:
:~/work/dashboard$ ./vendor/bin/sail up
[+] Running 3/3
⠿ Network dashboard_sail Created 0.1s
⠿ Container dashboard-mysql-1 Created 2.8s
⠿ Container dashboard-laravel.test-1 Created 1.1s
Attaching to dashboard-laravel.test-1, dashboard-mysql-1
dashboard-mysql-1 | [Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
dashboard-mysql-1 | [Entrypoint] Starting MySQL 8.0.31-1.2.10-server
dashboard-mysql-1 | 2022-10-17T10:10:38.740784Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
dashboard-mysql-1 | 2022-10-17T10:10:38.741647Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
dashboard-mysql-1 | 2022-10-17T10:10:38.750935Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
dashboard-mysql-1 | 2022-10-17T10:10:38.795221Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
dashboard-mysql-1 | 2022-10-17T10:10:39.287522Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
dashboard-mysql-1 | 2022-10-17T10:10:39.287656Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
dashboard-mysql-1 | 2022-10-17T10:10:39.287668Z 0 [ERROR] [MY-010119] [Server] Aborting
dashboard-mysql-1 | 2022-10-17T10:10:39.287971Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
dashboard-laravel.test-1 | 2022-10-17 10:10:41,882 INFO Set uid to user 0 succeeded
dashboard-laravel.test-1 | 2022-10-17 10:10:41,883 INFO supervisord started with pid 1
dashboard-laravel.test-1 | 2022-10-17 10:10:42,885 INFO spawned: 'php' with pid 16
dashboard-laravel.test-1 |
dashboard-laravel.test-1 | Illuminate\Database\QueryException
dashboard-laravel.test-1 |
dashboard-laravel.test-1 | SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: Temporary failure in name resolution (SQL: select * from information_schema.tables where table_schema = dashboard and table_name = report_errors and table_type = 'BASE TABLE')
.env
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=dashboard
DB_USERNAME=sail
DB_PASSWORD=password
and when I open http://localhost I get This site can’t be reached. How to fix this?
[Update]
I run docker ps -a and fount 2 containers: onr for sail and the other for MySQL.
f20cf9718056 sail-8.1/app ... dashboard-laravel.test-1
b7007d3a061c mysql/mysql-server:8.0 ... dashboard-mysql-1
I run docker-compose start and both containers are running.
docker-compose start
Starting mysql ... done
Starting laravel.test ... done
Now I try to run ./vendor/bin/sail up But I get
SQLSTATE[HY000] [2002] Connection refused
I run docker ps but the MySQL container exit
f20cf9718056 sail-8.1/app "start-container" About an hour ago Up 2 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:5173->5173/tcp, :::5173->5173/tcp, 8000/tcp dashboard-laravel.test-1
MySQL Logs
docker logs dashboard-mysql-1
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T14:01:13.615764Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T14:01:13.616826Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T14:01:13.627454Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T14:01:13.832319Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T14:01:14.321686Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T14:01:14.321863Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T14:01:14.321881Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T14:01:14.322186Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T14:10:37.311446Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T14:10:37.312494Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T14:10:37.331341Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T14:10:37.442677Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T14:10:37.932648Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T14:10:37.932756Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T14:10:37.932772Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T14:10:37.933079Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T14:10:47.381949Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T14:10:47.382974Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T14:10:47.389572Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T14:10:47.411196Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T14:10:47.901979Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T14:10:47.902111Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T14:10:47.902128Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T14:10:47.902444Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
[Entrypoint] MySQL Docker Image 8.0.31-1.2.10-server
[Entrypoint] Starting MySQL 8.0.31-1.2.10-server
2022-10-17T15:04:03.773574Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2022-10-17T15:04:03.774621Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
2022-10-17T15:04:03.788273Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-10-17T15:04:03.852948Z 1 [ERROR] [MY-012960] [InnoDB] Cannot create redo log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
2022-10-17T15:04:04.341269Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-17T15:04:04.341410Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-17T15:04:04.341425Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-17T15:04:04.341726Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.

I did not use Laravel Sail I prefer to make my own docker and docker-compose files so let me get you a bit closer to the error. Error : Failed to connect to server: php_network_getaddresses: getaddrinfo failed this error can occur due to two reasons.
there might be an issue with your DNS settings
PHP may not be able to get the network addresses for a given
host/domain name.
so you need to make sure the service name in your docker file for MYSQL is used in your Laravel .env file as a DB_HOST. and one more thing Laravel is trying to make a select statement somehow outside of the container so you got the mentioned error above in case you took care of the 2 points I mentioned above.

Related

MYSQL 8.0 - unsupported redo log format

I have recently updated mysql that was located under my xampp folder, and i've got the following errors, reporting from the log file :
2018-04-19T12:59:19.667059Z 0 [System] [MY-010116] [Server] C:\xampp\mysql\bin\mysqld.exe (mysqld 8.0.11) starting as process 9324
2018-04-19T12:59:20.025280Z 1 [ERROR] [MY-013090] [InnoDB] InnoDB: Unsupported redo log format (0). The redo log was created before MySQL 5.7.9
2018-04-19T12:59:20.026140Z 1 [ERROR] [MY-012930] [InnoDB] InnoDB: Plugin initialization aborted with error Generic error.
2018-04-19T12:59:20.229069Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
2018-04-19T12:59:20.230803Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2018-04-19T12:59:20.231371Z 0 [ERROR] [MY-010119] [Server] Aborting
2018-04-19T12:59:20.233136Z 0 [System] [MY-010910] [Server] C:\xampp\mysql\bin\mysqld.exe: Shutdown complete (mysqld 8.0.11) MySQL Community Server - GPL.
I have been told if updating your mysql, you should comment out the deprecated configs that are located in your my.ini, but i had no idea what to comment out, so i left it as it is.
Any idea what causes this?
If you have already installed MySQL and did not perform a slow shutdown using the
innodb_fast_shutdown
Flag, simply go to your MySQL directory
/var/lib/mysql/
And remove the log files (Do not do this if you need the table data in your database until you have backed up your database):
ib_logfile0
ib_logfile1
Back them up before if you need them again.
Docker users
I faced with the same error while using dockerized mariaDB.
The solution was:
remove the docker image:
docker image ls
docker rmi imagename
remove the volume:
docker volume ls
docker volume rm yourvolume
remove the container:
docker ps -a
docker rm yourcontainer
Then:
docker-compose up
Windows 10 Users
Also in windows if you want to remove the log files as it was suggested earlier:
The ib_logfiles are in
C:\ProgramData\MySQL\MySQL Server x.x\Data
Mac OS X Users
The ib_logfiles are here
rm /usr/local/var/mysql/ib_logfile*
In my case, I have deleted the complete folder /var/lib/mysql and restarted the mysql service and it worked...
rm -rf /var/lib/mysql
Note: You may loose your data if you delete that folder

after update Ubuntu to 16.04 and re-install mysql 5.7, FF-browser doesn't display any query results

problem is: after re-install mysql 5.7, FF-browser and Chrome-browser doesn't display any query results. I tested with standart querys from mysql-manual:
$link = mysqli_connect("localhost", "root", "cydb4tsa", "RedGround");
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
echo "Table myCity successfully created.";
}
please understand: i'm not an administrator, not used to handle such problems every day.
My project is in serious threat, because I upgraded to Ubuntu 16.04 with mysql-server-5.7, result after all is that no query result is displayed in FF-browser or Chrome ... I miss feedback on my call for help (I included step by step report of the problem) in 'ask Ubuntu'.
i tried analyzing mysql_errors:
cat error.log | grep 'Warning'
sebu#sebu-Inspiron-3437:/var/log/mysql$ cat error.log | grep 'Warning'
2017-01-20T03:25:22.334192Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-01-20T03:25:22.334288Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-01-20T03:25:22.650055Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-20T03:25:25.671903Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-01-20T22:29:11.912552Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-01-20T22:29:11.912644Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-01-20T22:29:12.294907Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-20T22:29:15.527007Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-01-20T22:35:01.057707Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-01-20T22:35:01.057815Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-01-20T22:35:03.952763Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-01-20T22:35:10.096231Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
/var/log/mysql# ulimit -n 5000
also done:
mysql> SET GLOBAL table_open_cache = 2000;
no effect and varables went back to old value after reboot
i can provide some more info now:
i search for updates for Ubuntu 16.04 and following happened:
after install
report was sent
yes i modified link-source from mysql.cnf but i disable this modifications because they caused an error-msg.
please release this report from hold status, or give me info where is the right place for this topic!
after the newest update even the command-line function cause an error-msg,
befor this part was working normaly.
~$ mysql -u root -pcydb4tsa RedGround
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
note) After updating Ubuntu again (new ubuntu kernel) the command line mysql> run without error. The newerly update finished successfully, but i still get an empty screen on my web-browser after running test scripts :-(
maybe good to know:
phpMyAdmin works without any problems. Why and How phpMyAdmin can properly connect my DB ????

MAMP: Unable to start MySQL after upgrade from 5.5 to 5.7

I upgraded mySQL from 5.5. to 5.7. I am not being able to make MAMP running MYSQL. Error log gives that:
160617 14:45:13 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql
2016-06-17T09:45:13.908521Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-06-17T09:45:13.976451Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2016-06-17T09:45:13.976701Z 0 [Note] /Applications/MAMP/Library/bin/mysqld (mysqld 5.7.9) starting as process 28255 ...
2016-06-17T09:45:14.111330Z 0 [Warning] Setting lower_case_table_names=2 because file system for /Applications/MAMP/db/mysql/ is case insensitive
2016-06-17T09:45:14.136797Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-06-17T09:45:14.136828Z 0 [Note] InnoDB: Uses event mutexes
2016-06-17T09:45:14.136838Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-06-17T09:45:14.136849Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-06-17T09:45:14.137452Z 0 [Note] InnoDB: Number of pools: 1
2016-06-17T09:45:14.145153Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2016-06-17T09:45:14.230174Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-06-17T09:45:14.299060Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-06-17T09:45:14.395299Z 0 [ERROR] InnoDB: ./ib_logfile0 can't be opened in read-write mode.
2016-06-17T09:45:14.395336Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-06-17T09:45:14.707209Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-06-17T09:45:14.707274Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-06-17T09:45:14.707335Z 0 [ERROR] Failed to initialize plugins.
2016-06-17T09:45:14.707361Z 0 [ERROR] Aborting
2016-06-17T09:45:14.707400Z 0 [Note] Binlog end
2016-06-17T09:45:14.707585Z 0 [Note] Shutting down plugin 'CSV'
2016-06-17T09:45:14.719175Z 0 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete
160617 14:45:14 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
Fix
Open up a terminal and chown MAMP's mysql database folder :
sudo chown -R `whoami`:admin /Applications/MAMP/db/mysql
Explanation
I just ran into the same error, the hint is here :
[ERROR] InnoDB: ./ib_logfile0 can't be opened in read-write mode.
It means that the user running mysqld isn't allowed to read-write. But _mysql is the owner of this file :
-rw-r----- 1 _mysql admin 50331648 10 avr 22:35 ib_logfile0
I ran ps -axj | grep mysql right after launching the server, and saw I was the owner of mysqld, instead of being owned by _mysql.
It's a breaking change, I think we should have been warned in the release note.

Maxscale lost connection

I'm currently testing Maxscale with a Galera Cluster of 3 nodes in Read/Write Split mode. By default, Maxscale defines one node as a master and the other as slaves (my configuration says 100% of the slaves).
My intend is to check how Maxscale handles node shutdowns.
The problem is that with benchmarks (Sysbench, Mysqlslap) and also custom scripts (PHP), the connection to the backend (MariaDB) gets lost when I shut down a node of the cluster.
Error log:
MariaDB Corporation MaxScale /var/log/maxscale/error1.log Thu Oct 29 13:00:11 2015
-----------------------------------------------------------------------
--- Logging is enabled.
2015-10-29 13:00:11 Error: Failed to obtain address for host ::1, Address family for hostname not supported
2015-10-29 13:00:11 Warning: Failed to add user root#::1 for service [RW Split Router]. This user will be unavailable via MaxScale.
2015-10-29 13:00:11 Warning: Duplicate MySQL user found for service [RW Split Router]: cmon#127.0.0.1 for database: (null)
2015-10-29 13:00:11 Warning: Duplicate MySQL user found for service [RW Split Router]: root#127.0.0.1 for database: (null)
2015-10-29 13:00:11 Warning: Duplicate MySQL user found for service [RW Split Router]: root#10.58.224.113 for database: (null)
2015-10-29 13:00:35 Error : Unable to write to backend due to authentication failure.
2015-10-29 13:00:40 Error : Monitor was unable to connect to server 10.58.224.113:3306 : "Can't connect to MySQL server on '10.58.224.113' (111)"
Trace log:
2015-10-29 13:00:33 [4] Route query to slave 10.58.224.113:3306 <
2015-10-29 13:00:33 [4] Servers and router connection counts:
2015-10-29 13:00:33 [4] current operations : 0 in 10.58.224.113:3306 RUNNING SLAVE
2015-10-29 13:00:33 [4] current operations : 0 in 10.26.116.84:3306 RUNNING SLAVE
2015-10-29 13:00:33 [4] current operations : 0 in 10.26.84.103:3306 RUNNING MASTER
2015-10-29 13:00:33 [4] Selected RUNNING SLAVE in 10.58.224.113:3306
2015-10-29 13:00:33 [4] Selected RUNNING SLAVE in 10.26.116.84:3306
2015-10-29 13:00:33 [4] Selected RUNNING MASTER in 10.26.84.103:3306
2015-10-29 13:00:34 [4] > Autocommit: [enabled], trx is [not open], cmd: COM_QUERY, type: QUERY_TYPE_READ, stmt: SELECT COUNT(*) FROM sbtest1
2015-10-29 13:00:34 [4] Route query to slave 10.58.224.113:3306 <
2015-10-29 13:00:36 [4] Stopped RW Split Router client session [4]
2015-10-29 13:00:42 Server changed state: server1[10.58.224.113:3306]: slave_down
PHP test script
<?php
# Test MaxScale
$db = new PDO('mysql:host=127.0.0.1;dbname=sbtest;charset=utf8;port=4446;', 'root', '***', array(PDO::ATTR_TIMEOUT => "10", PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
for($i=0; $i<5000; $i++)
{
try{
$q = $db->query('SELECT COUNT(*) FROM sbtest1', PDO::FETCH_NUM);
if($q){
$res = $q->fetchAll();
#var_dump($res);
echo time()." Result: {$res[0][0]}\n";
sleep(1);
}
}
catch(PDOException $Exception) {
echo "PDOException: " . $Exception->getMessage() . "\n";
die('forced script to stop');
}
}
Mysqlslap benchmark:
mysqlslap -h127.0.0.1 -uroot -p*** -P4446 --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" --query="SELECT * FROM a" --concurrency=50 --iterations=200 --delimiter=";"
Sysbench benchmark:
sysbench --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-table-size=2500 --mysql-user=root --mysql-password=*** --mysql-host=127.0.0.1 --db-ps-mode=disable --mysql-port=4446 prepare
sysbench --num-threads=16 --max-requests=5000 --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp-skip-trx=on --oltp-read-only=on --oltp-table-size=250000 --mysql-host=127.0.0.1 --mysql-user=root --mysql-password=*** --mysql-port=4446 run
Encountered errors:
PDOException: SQLSTATE[HY000]: General error: 2003 Authentication with backend failed. Session will be closed.
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
PDOException: SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query
Maxscale configuration:
[maxscale]
threads=4
auth_connect_timeout=20
auth_read_timeout=20
auth_write_timeout=20
log_trace=1
[Galera Monitor]
type=monitor
module=galeramon
servers=server1,server2,server3
user=maxmon
passwd=***
monitor_interval=30000
backend_connect_timeout=10
backend_read_timeout=10
backend_write_timeout=10
[RW Split Router]
type=service
router=readwritesplit
servers=server2,server3,server1
user=root
passwd=***
max_slave_connections=100%
enable_root_user=1
router_options=slave_selection_criteria=LEAST_CURRENT_OPERATIONS
[Debug Interface]
type=service
router=debugcli
[CLI]
type=service
router=cli[Debug Interface]
type=service
router=debugcli
[CLI]
type=service
router=cli
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4446
[Debug Listener]
type=listener
service=Debug Interface
protocol=telnetd
address=127.0.0.1
port=4442
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
port=6603
[server1]
type=server
address=10.58.224.113
port=3306
protocol=MySQLBackend
[server2]
type=server
address=10.26.84.103
port=3306
protocol=MySQLBackend
[server3]
type=server
address=10.26.116.84
port=3306
protocol=MySQLBackend
Session monitoring shows that the sessions gets invalid like in the following example:
# maxadmin -pmariadb show sessions
Session 9 (0x7f60a4000b50)
State: Invalid State
Service: RW Split Router (0x342f460)
Client DCB: 0x7f60a40009a0
Client Address: root#127.0.0.1
Connected: Thu Oct 29 13:28:57 2015
I also played around with different timeouts variables and monitor_interval in Maxscale and also in my PHP testing script (PDO timeout), but the problem seems to be how Maxscale handles MySQL sessions.
I also read about the optimistic way of Maxscale which is forwarding the quickest response it gets from one of the nodes, but not sure if this is the cause.
Is there a way to make node shutdowns unharmful for any SQL requests propagated by Maxscale to all slave nodes of a cluster ?

frequent automatic restart of mysql server and later permanent shutdown [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
The MySQL server is restarting frequently. 75 times in less than 24 hours. And finally its ending without restarting!
Please check the details log here: mysqld.log
140113 10:18:22 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
140113 10:18:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140113 10:18:31 InnoDB: Initializing buffer pool, size = 8.0M
140113 10:18:31 InnoDB: Completed initialization of buffer pool
140113 10:18:31 InnoDB: Started; log sequence number 16 1064411530
140113 10:18:32 [Note] Event Scheduler: Loaded 0 events
140113 10:18:32 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.61' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
140113 18:45:09 mysqld_safe Number of processes running now: 0
140113 18:45:10 mysqld_safe mysqld restarted
140113 18:45:10 InnoDB: Initializing buffer pool, size = 8.0M
140113 18:45:10 InnoDB: Completed initialization of buffer pool
140113 18:45:10 InnoDB: Started; log sequence number 16 1064411530
140113 18:45:11 [Note] Event Scheduler: Loaded 0 events
140113 18:45:11 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.61' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
......
140114 9:50:12 InnoDB: Initializing buffer pool, size = 8.0M
140114 9:50:12 InnoDB: Completed initialization of buffer pool
140114 9:50:12 InnoDB: Started; log sequence number 16 1064411530
140114 9:50:13 [Note] Event Scheduler: Loaded 0 events
140114 9:50:13 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.61' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
140114 09:55:07 mysqld_safe Number of processes running now: 0
140114 09:55:07 mysqld_safe mysqld restarted
140114 9:55:08 InnoDB: Initializing buffer pool, size = 8.0M
140114 9:55:08 InnoDB: Completed initialization of buffer pool
140114 09:55:08 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
In the meantime its killing 62 processes due to out of memory. Please check the detail log: messages
Jan 14 09:41:53 centos63 kernel: Out of memory: Kill process 16795 (mysqld) score 20 or sacrifice child
Jan 14 09:41:53 centos63 kernel: Killed process 16795, UID 27, (mysqld) total-vm:574508kB, anon-rss:20488kB, file-rss:164kB
I am running a cronjob in each 5 minutes which is affecting some tables with about 200000, 50000, 25000 data in three tables.
SELECT over 1,257 members then over 9,844 member_boards and then INSERT/UPDATE over 168,624 member_cards using the below pseudocode:
<?php
$qry = _("SELECT _members");
while($member = mysql_fetch_assoc($res))
{//1,257
$qry = _("SELECT _member_boards");
while($db_board = mysql_fetch_assoc($board_res))
{//9,844
$s_lists = curl_download("https://api.com/boards/lists");
foreach ($lists as $list) {//9,844
if(!strcmp('SOMETHING', $list->name)){//Matching with API and DB
$curl = "https://api.com/lists/cards";
foreach ($cards as $card) {//168,624
$qry = _("SELECT _member_cards");
if($card_row = mysql_fetch_assoc($card_res)){
$qry = _("UPDATE _member_cards");
}
else{
echo $qry = _("INSERT _member_cards");
}
}
}
}
}
$qry = _("UPDATE _member_cards");
}
?>
So what can be the reason and how can I solve this issue?
RAM 512 MB until now.
CentOS
Can scaling RAM up to 1 GB solve the issue?
Your MySQL server is getting killed because it uses too much memory; you can either add more RAM to the server or try lowering MySQL's memory usage by changing some values in its configuration file; however that may affect performance.
Take a look at this question and this one for guides about tweaking MySQL's configuration - it's not an easy task and it's based on trial and error, you should try different values until you get a good balance between performance and memory usage.

Categories