DockStack icon indicating copy to clipboard operation
DockStack copied to clipboard

./stack.sh fails to connect to mysql

Open pablosjv opened this issue 7 years ago • 4 comments
trafficstars

Hello, I'm new to OpenStack. I've been trying to use Dockstack to learn and test some small deployments. I think is a very cool idea to have a small dev environment in a container on your local machine :+1:

I run first make build, which goes smoothly. Then I executed make run. It seems that the ./stack.sh command is failing when trying to connect to the database. I don't understand the ./stack.sh script, so I don't know what is happening. I put the output bellow:

+stack.sh:main:1008                        configure_database
+lib/database:configure_database:128       configure_database_mysql
+lib/databases/mysql:configure_database_mysql:61  local my_conf mysql slow_log
+lib/databases/mysql:configure_database_mysql:62  echo_summary 'Configuring and starting MySQL'
+stack.sh:echo_summary:433                 [[ -t 3 ]]
+stack.sh:echo_summary:433                 [[ True != \T\r\u\e ]]
+stack.sh:echo_summary:439                 echo -e Configuring and starting MySQL
2018-02-09 11:09:20.967 | Configuring and starting MySQL
+lib/databases/mysql:configure_database_mysql:64  is_ubuntu
+functions-common:is_ubuntu:462            [[ -z deb ]]
+functions-common:is_ubuntu:465            '[' deb = deb ']'
+lib/databases/mysql:configure_database_mysql:65  my_conf=/etc/mysql/my.cnf
+lib/databases/mysql:configure_database_mysql:79  is_fedora
+functions-common:is_fedora:435            [[ -z Ubuntu ]]
+functions-common:is_fedora:439            '[' Ubuntu = Fedora ']'
+functions-common:is_fedora:439            '[' Ubuntu = 'Red Hat' ']'
+functions-common:is_fedora:440            '[' Ubuntu = RedHatEnterpriseServer ']'
+functions-common:is_fedora:441            '[' Ubuntu = CentOS ']'
+functions-common:is_fedora:441            '[' Ubuntu = OracleServer ']'
+functions-common:is_fedora:442            '[' Ubuntu = Virtuozzo ']'
+lib/databases/mysql:configure_database_mysql:79  is_suse
+functions-common:is_suse:450              [[ -z Ubuntu ]]
+functions-common:is_suse:454              [[ Ubuntu =~ (openSUSE) ]]
+functions-common:is_suse:454              [[ Ubuntu == \S\U\S\E\ \L\I\N\U\X ]]
+lib/databases/mysql:configure_database_mysql:87  sudo mysqladmin -u root password secret
mysqladmin: connect to server at '127.0.0.1' failed
error: 'Can't connect to MySQL server on '127.0.0.1' (111)'
Check that mysqld is running on 127.0.0.1 and that the port is 3306.
You can check this by doing 'telnet 127.0.0.1 3306'
+lib/databases/mysql:configure_database_mysql:87  true
+lib/databases/mysql:configure_database_mysql:90  sudo mysql -uroot -psecret -h127.0.0.1 -e 'GRANT ALL PRIVILEGES ON *.* TO '\''root'\''@'\''%'\'' identified by '\''secret'\'';'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
+lib/databases/mysql:configure_database_mysql:1  exit_trap
+stack.sh:exit_trap:510                    local r=1
++stack.sh:exit_trap:511                    jobs -p
+stack.sh:exit_trap:511                    jobs=
+stack.sh:exit_trap:514                    [[ -n '' ]]
+stack.sh:exit_trap:520                    '[' -f /tmp/tmp.oZEVMePGQz ']'
+stack.sh:exit_trap:521                    rm /tmp/tmp.oZEVMePGQz
+stack.sh:exit_trap:525                    kill_spinner
+stack.sh:kill_spinner:424                 '[' '!' -z '' ']'
+stack.sh:exit_trap:527                    [[ 1 -ne 0 ]]
+stack.sh:exit_trap:528                    echo 'Error on exit'
Error on exit
+stack.sh:exit_trap:530                    type -p generate-subunit
+stack.sh:exit_trap:531                    generate-subunit 1518173927 634 fail
+stack.sh:exit_trap:533                    [[ -z /opt/stack/logs ]]
+stack.sh:exit_trap:536                    /devstack/tools/worlddump.py -d /opt/stack/logs
World dumping... see /opt/stack/logs/worlddump-2018-02-09-110921.txt for details
+stack.sh:exit_trap:545                    exit 1
Makefile:40: recipe for target 'run' failed
make: *** [run] Error 1

Thank you very much

pablosjv avatar Feb 09 '18 12:02 pablosjv

Similar issue here! Happy to collaborate on figuring out a solution! I really want to get this running and clearly some dependencies have broken in the past 6 months that this repo has not been updated! Perhaps you could also post your full log after running make run rather than just the snippet. Also the content of your world dump.

brtkwr avatar Feb 09 '18 16:02 brtkwr

I am not sure the two issues are related, see my answer in the other thread.

@pablosjv it would be really helpful if you could provide the full logs and some information about your machine and software stack.

As you can see in the Dockerfile lines 99ff, MySQL is set up during Docker build. Maybe there was an error during build?

I just tested the whole setup:

  1. git clone from scratch
  2. docker system prune -a -f // careful!
  3. Exclude lint from the Makefile #3
  4. make
  5. Wait
  6. Works perfectly fine

I did not change the Dockerfile. So it automatically pulls the latest master from DevStack/OpenStack.

janmattfeld avatar Feb 10 '18 14:02 janmattfeld

I have tried again the make process following the steps you mention above. I am getting the same issue as before.

Here is the content of my world dump, and here are the full make's logs. My host OS is an Ubuntu 17.10 and the docker version is 17.12.0-ce, build c97c6d6.

Thank you very much!

EDIT:

I've seen the answers in the thread #2 and I have tried the suggestion just in case the issues are related. I keep getting the same error message from MySQL.

pablosjv avatar Feb 12 '18 10:02 pablosjv

Your setup and logs look fine. Next steps would be

  1. Entering the container manually
  2. Check that MySQL is running
  3. Connect to mysqld

Might be interesting why it's not working. But if you just need a running DevStack I'd go for a separate machine or VM and use the official guide: https://docs.openstack.org/devstack/latest/index.html

That way you get more insights into the setup process and OpenStack itself.

janmattfeld avatar Feb 12 '18 11:02 janmattfeld