gpt4 book ai didi

mysql - 为什么 puppet 在 MySQL 重启时删除 Travis CI 中的数据库?

转载 作者:行者123 更新时间:2023-11-29 12:42:06 25 4
gpt4 key购买 nike

我有以下puppet recipe在运行 my build 时应用新配置并重新启动 MySQL 服务器关于 Travis CI:

class { '::mysql::server':
root_password => 'root',
override_options => {
'mysqld' => {
'max_connections' => '512',
'max_allowed_packet' => '12M'
}
},
restart => true
}

但是在我应用这个方法之后,我的 MySQL 数据库就消失了。

日志是:

$ echo "SHOW DATABASES" | mysql -uroot -proot 
Database
information_schema
mysql
performance_schema
travis_ads_test
$ sudo puppet apply puppet/ads.dev.configure-site.pp
Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations
(at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1117:in `issue_deprecation_warning')
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Notice: Compiled catalog for ads.localdomain in environment production in 2.29 seconds
Notice: /Stage[main]/Mysql::Server::Config/File[/etc/mysql/my.cnf]/content: content changed '{md5}b199076b6b1a40b6cd6f8f0c464977e9' to '{md5}0d8e003c4dfe5cfd85de1d06cc7c4eb7'
Notice: /Stage[main]/Mysql::Server::Service/Service[mysqld]: Triggered 'refresh' from 1 events
Notice: /Stage[main]/Mysql::Server::Service/File[/var/log/mysql/error.log]/group: group changed 'adm' to 'mysql'
Notice: /Stage[main]/Mysql::Server::Root_password/Mysql_user[root@localhost]/password_hash: defined 'password_hash' as '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B'
Notice: /Stage[main]/Mysql::Server::Root_password/File[/root/.my.cnf]/ensure: defined content as '{md5}f2ee51638cc14fb3396202254d9f14a0'
Notice: /Stage[main]/Main/Apache::Vhost[ads.localhost]/File[/var/www/ads]/owner: owner changed 'travis' to 'root'
Notice: /Stage[main]/Main/Apache::Vhost[ads.localhost]/File[/var/www/ads]/group: group changed 'travis' to 'root'
Notice: /Stage[main]/Main/Apache::Vhost[ads.localhost]/File[25-ads.localhost.conf]/ensure: created
Notice: /Stage[main]/Main/Apache::Vhost[ads.localhost]/File[25-ads.localhost.conf symlink]/ensure: created
Notice: /Stage[main]/Apache::Service/Service[httpd]: Triggered 'refresh' from 2 events
Notice: Finished catalog run in 7.08 seconds
The command "sudo puppet apply puppet/ads.dev.configure-site.pp" exited with 0.
$ echo "SHOW DATABASES" | mysql -uroot -proot && echo "SHOW TABLES" | drush sql-cli
Database
information_schema
mysql
performance_schema
Calling proc_open(mysql --database=travis_ads_test --host=localhost --port=3306 --user=root --password=root);
ERROR 1049 (42000): Unknown database 'travis_ads_test'

我的数据库 travis_ads_test 消失了。有什么原因吗?

我通过 puppet 重新启动 MySQL 时做错了什么,还是 Travis CI 的某种功能?

最佳答案

似乎不需要restart,因为 puppetlabs-mysql 模块将管理配置更改所需的所有重新启动,正如您从以下消息中看到的:

Config/File[/etc/mysql/my.cnf]/content: content changed
Service/Service[mysqld]: Triggered 'refresh' from 1 events

如果您确实需要重新启动,请检查:Restarting mysql utilizing the puppetlabs/mysql module?

所以解决方案是删除restart => true,但是为什么数据库丢失,我不确定。

可能您的数据库没有被删除,但通过更改凭据,您更改了该用户对数据库的访问权限。如果您在更改之前已有 root 密码,并且希望通过 Puppet 更改 root 密码,则需要 old_root_password

查看文档以获取更多信息:

关于mysql - 为什么 puppet 在 MySQL 重启时删除 Travis CI 中的数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25964936/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com