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

DB error using another mysql instance #104

Open
amfgomez opened this issue Jun 26, 2019 · 21 comments
Open

DB error using another mysql instance #104

amfgomez opened this issue Jun 26, 2019 · 21 comments

Comments

@amfgomez
Copy link

amfgomez commented Jun 26, 2019

Hello

I am trying to use a mysql instance, mysql is installed in native on a VM.

when the docker keystone container is deployed the following error:

ERROR 1049 (42000) at line 1: Unknown database 'keystone'
ERROR 1008 (HY000) at line 1: Can't drop database 'keystone'; database doesn't exist
ERROR 1044 (42000) at line 2: Access denied for user 'root'@'myip' to database 'keystone'
Either --bootstrap-password argument or OS_BOOTSTRAP_PASSWORD must be set.
/usr/lib/python2.7/site-packages/keystoneclient/shell.py:64: DeprecationWarning: The keystone CLI is deprecated in favor of python-openstackclient. For a Python library, continue using python-keystoneclient.
'python-keystoneclient.', DeprecationWarning)
/usr/lib/python2.7/site-packages/keystoneclient/v2_0/client.py:145: DeprecationWarning: Constructing an instance of the keystoneclient.v2_0.client.Client class without a session is deprecated as of the 1.7.0 release and may be removed in the 2.0.0 release.
'the 2.0.0 release.', DeprecationWarning)

In Mysql:

  • Keystone database has been created.
  • I execute a grand command to allow root user.
    * GRANT ALL ON keystone.* TO root@'myip IDENTIFIED BY 'mypass;
    * docker restart keystone && docker logs -f keystone

myip port 3306 open.
ERROR 1146 (42S02) at line 1: Table 'keystone.domain' doesn't exist
{
"admin_required": "role:admin",
"cloud_admin": "rule:admin_required and domain_id:",
"service_role": "role:service",
Note: Forwarding request to 'systemctl enable openstack-keystone.service'.
ERROR 1146 (42S02) at line 1: Table 'keystone.local_user' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'keystone.local_user' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'keystone.local_user' doesn't exist
ERROR 1146 (42S02) at line 1: Table 'keystone.local_user' doesn't exist
[ keystone-entrypoint - keystone-all ]
2019-06-26 15:23:01.595 83 ERROR keystone File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 97, in connect
2019-06-26 15:23:01.595 83 ERROR keystone return dialect.connect(*cargs, **cparams)
2019-06-26 15:23:01.595 83 ERROR keystone File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 385, in connect
2019-06-26 15:23:01.595 83 ERROR keystone return self.dbapi.connect(*cargs, **cparams)
2019-06-26 15:23:01.595 83 ERROR keystone File "/usr/lib64/python2.7/site-packages/MySQLdb/init.py", line 81, in Connect
2019-06-26 15:23:01.595 83 ERROR keystone return Connection(*args, **kwargs)
2019-06-26 15:23:01.595 83 ERROR keystone File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 193, in init
2019-06-26 15:23:01.595 83 ERROR keystone super(Connection, self).init(*args, **kwargs2)
2019-06-26 15:23:01.595 83 ERROR keystone OperationalError: (_mysql_exceptions.OperationalError) (1045, "Access denied for user 'keystone'@'myip' (using password: YES)")
2019-06-26 15:23:01.595 83 ERROR keystone

  • GRANT ALL ON keystone.* TO keystone@'myip IDENTIFIED BY 'mypass;

  • docker restart keystone && docker logs -f keystone

the log returns the same previous error.

Keystone cannot create anything when I use a mysql instance different a docker container.

@fgalan
Copy link
Member

fgalan commented Jun 26, 2019

Keystone cannot create anything when I use a mysql instance different a docker container.

So you mean that with MySQL in a docker container works and with MySQL outside a docker container (in the docker host or a third system) doesn't work. Is my understanding correct?

@amfgomez
Copy link
Author

In a third system is where the keystone doesn´t work.

@fgalan
Copy link
Member

fgalan commented Jun 26, 2019

If the MySQL is installed in the docker host (i.e. the system running the containers) it works?

@amfgomez
Copy link
Author

I don´t test this example, because I need the mysql instance in another VM

@fgalan
Copy link
Member

fgalan commented Jun 26, 2019

Have you used a docker-compose.yml to deploy your containers? In that case, could you post it in the issue as comment, pls?

@amfgomez
Copy link
Author

I have used Docker image with the following command:
docker run --name keystone -d -p 5001:5001 -h keystone telefonicaiot/fiware-keystone-spassword -dbhost myip -default_pwd mykeypass -mysql_pwd rootpassw

@fgalan
Copy link
Member

fgalan commented Jun 26, 2019

Does your external MySQL accept connections from outside systems (default DB configuration uses to have that posibility disabled, so only connection from localhost are allowed)? You could try with mysql command from the same place you have run docker run.

@amfgomez
Copy link
Author

I have connected keypass and another tool from docker machine, the problem is Keystone.

@AlvaroVega
Copy link
Member

@amfgomez are you sure that you can connect from outside of mysql conteiner using root user /rootpassw? Have you tried from command line?

@amfgomez
Copy link
Author

I have deployed Keypass like container in the same vm and Keypass use mysql instance, keypass works fine.
In another VM executed
mysql -u root -h X.X.X.X -p // it works fine.

@amfgomez
Copy link
Author

I have used command line and MySQL workbench.

@AlvaroVega
Copy link
Member

Maybe you can get into keystone container and execute then: mysql -u root -h X.X.X.X -p

@amfgomez
Copy link
Author

image

@AlvaroVega
Copy link
Member

Which version of keystone docker image are you using?

@amfgomez
Copy link
Author

image
Last version

@AlvaroVega
Copy link
Member

And how old is that latest version ?

@AlvaroVega
Copy link
Member

Maybe you should execute:

GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
    IDENTIFIED BY 'keystone';

as uses docker installation script:
https://github.com/telefonicaid/fiware-keystone-spassword/blob/master/docker/postlaunchconfig.sh#L40

@AlvaroVega
Copy link
Member

AlvaroVega commented Jun 28, 2019

Keystone is in charge of create keystone database when is needed. Also keystone container is able to detect if previous installation exists or not, queering keystone database existence. In your case you created keystone database, but was empty. You should not create database.
Please remove keystone database (that I guess is empty) and restart container.

@amfgomez
Copy link
Author

amfgomez commented Jul 3, 2019

1º List databases and drop databases
image

2º restart the keystone container
image

3º Grant root permission with same password sets in the container.
image

4 º Log from keystone container.
image
image

Keystone can not execute the SQL. keystone only create the keystone database.

@AlvaroVega
Copy link
Member

Is your third step "3º Grant root permission with same password sets in the container." using a different password to default password? I don't see how keystone container was launched.

@amfgomez
Copy link
Author

amfgomez commented Jul 3, 2019

the same password in container creation and grant command.

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

3 participants