0
罗列所有container的IP地址
单独monitor某个contrainer的logs
Posted on
Thursday, August 30, 2018
by
醉·醉·鱼
and labeled under
docker
罗列所有container的IP地址
docker ps -q | xargs -n 1 docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} {{ .Name }}'
单独monitor某个contrainer的logs
docker ps -a | grep payments | sed 's/ .*//' | xargs docker logs -f
0
DatabaseCleaner上面的example过时了。按照示例去做的话,会报错 unknown method 'before'。在github上找到了答案,还是比较简单的。
配置完成以后,就可以在MYSQL去monitor query,看具体是如何操作数据库的。
观察log
最后,重置改动。
class ActiveSupport::TestCase
include FactoryGirl::Syntax::Methods
ActiveRecord::Migration.check_pending!
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.logger = Rails.logger
setup { DatabaseCleaner.start }
teardown { DatabaseCleaner.clean }
end
配置完成以后,就可以在MYSQL去monitor query,看具体是如何操作数据库的。
mysql> SHOW VARIABLES LIKE "general_log%";
+------------------+----------------------------+
| Variable_name | Value |
+------------------+----------------------------+
| general_log | OFF |
| general_log_file | /var/run/mysqld/mysqld.log |
+------------------+----------------------------+
mysql> SET GLOBAL general_log = 'ON';
观察log
tail -f -n300 /var/run/mysqld/mysqld.log
最后,重置改动。
mysql> SET GLOBAL general_log = 'OFF';
- https://stackoverflow.com/questions/568564/how-can-i-view-live-mysql-queries
- https://github.com/metaskills/minitest-spec-rails/issues/44#issuecomment-244155657