Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to MySQL in web serving benchmark #131

Closed
xxks-kkk opened this issue Apr 22, 2018 · 1 comment
Closed

Cannot connect to MySQL in web serving benchmark #131

xxks-kkk opened this issue Apr 22, 2018 · 1 comment
Assignees

Comments

@xxks-kkk
Copy link

Hello,

I'm using the web serving benchmark and all the components are on the localhost. I start them using the following commands:

docker run --security-opt seccomp:unconfined -dt --net=host --name=mysql_server cloudsuite/web-serving:db_server localhost
docker run --security-opt seccomp:unconfined -dt --net=host --name=memcache_server cloudsuite/web-serving:memcached_server
docker run --cap-add SYS_PTRACE --security-opt seccomp:unconfined -dt --net=host --name=web_server cloudsuite/web-serving:web_server /etc/bootstrap.sh
docker run --security-opt seccomp:unconfined --net=host --name=faban_client cloudsuite/web-serving:faban_client localhost

Then, the benchmark hung and never finish. I login to the web_server docker and examine the PHP-FPM master process using strace -f -s 2000 -o app2.trc -p 37 and I see

root@kettle:/usr/share/nginx/html# strace -f -s 2000 -o app2.trc -p 37
Process 37 attached
Process 15234 attached
Process 15235 attached
Process 15236 attached
Process 15237 attached
Process 15238 attached
Process 15239 attached
Process 15240 attached
Process 15241 attached
^CProcess 37 detached
Process 15240 detached
Process 15241 detached

That's an indication of processes under PHP-FPM dying quickly. Then, I look into the trace app2.trc and
I see

15234 write(2, "NOTICE: PHP message: PHP WARNING: 2018-04-21 19:55:45 (UTC): \"mm
ysql_connect(): Unknown MySQL server host 'mysql_server' (2)\" in file /usr/sharr
e/nginx/html/elgg/engine/classes/Elgg/Database.php (line 142)\n", 204) = 204

If I run strace command a little bit longer and I can see other warning messages

16349 connect(6, {sa_family=AF_LOCAL, sun_path="/var/run/mysqld/mysqld.sock"}, 11
10) = -1 ENOENT (No such file or directory)
16349 fcntl(6, F_SETFL, O_RDWR)         = 0
16349 shutdown(6, SHUT_RDWR)            = 0
16349 close(6)                          = 0
16349 write(2, "NOTICE: PHP message: PHP WARNING: 2018-04-21 20:17:25 (UTC): \"mm
ysql_real_escape_string(): Can't connect to local MySQL server through socket '//
var/run/mysqld/mysqld.sock' (2)\" in file /usr/share/nginx/html/elgg/engine/class
ses/Elgg/Database.php (line 602)\n", 255) = 255
16349 write(2, "NOTICE: PHP message: PHP WARNING: 2018-04-21 20:17:25 (UTC): \"mm
ysql_real_escape_string(): A link to the server could not be established\" in fii
le /usr/share/nginx/html/elgg/engine/classes/Elgg/Database.php (line 602)\n", 211
6) = 216

I think there might be some problem with my setup but I cannot figure out where.

Thanks for the help!

@ZiluTian
Copy link
Contributor

Hi,
Please check file settings.php in web_server container /usr/share/nginx/elgg/elgg-config, which is also specified in folder files/settings.php and make sure the
$CONFIG->dbhost = '127.0.0.1' or whatever the ip of your db server is. "localhost" wouldn't work.

Alternatively, please try to remove settings.php and go through the ELGG registration manually through a web browser by entering the details of the mysql database.

Regards,
Zilu

@ZiluTian ZiluTian self-assigned this Apr 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants