我想我的web应用程序在Windows上创建的端口,使用Hibernate,XAMPP的Apache Tomcat和MySQL服务器,到Linux,使用泊坞窗。巨大的潜伏期连接的webapp通过休眠
在我完成了以下步骤之后,我的web.app的第一个特性是登录/注册表单:在Windows上,所有工作都完美无缺,但是容器的延迟时间大约为数十分钟..有时候还有500 http错误!
docker run -d --name mysql-phpmyadmin -p 127.0.0.1:8686:80 -p 127.0.0.1:3306:3306 grzesiekb/mysql-phpmyadmin
docker run -d -p 8484:8080 -p 8007:8009 --name tomcat8-linked --link mysql-phpmyadmin:mysqlphp tomcat:8.0-jre8
,然后部署的webapps下/文件夹,我的warfile在我的hibernate.cfg.xml,你可以看到它here(我有问题,将其粘贴到可见的方式):)
在我的mysql容器my.cnf有:
[客户] 端口= 3306 插座= /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs # The following values assume you have at least 32M ram # This was formally known as [safe_mysqld]. Both versions are currently parsed. [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 0.0.0.0 # # * Fine Tuning # key_buffer = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 # This replaces the startup script and checks MyISAM tables if needed # the first time they are touched myisam-recover = BACKUP #max_connections = 100 #table_cache = 64 #thread_concurrency = 10 # # * Query Cache Configuration # query_cache_limit = 1M query_cache_size = 16M # # * Logging and Replication # # Both location gets rotated by the cronjob. # Be aware that this log type is a performance killer. # As of 5.1 you can enable the log at runtime! general_log_file = /var/log/mysql/mysql.log general_log = 1 # # Error log - should be very few entries. # log_error = /var/log/mysql/error.log # # Here you can see queries with especially long duration #slow_query_log_file = /var/log/mysql/mysql-slow.log #slow_query_log = 1 #long_query_time = 2 #log_queries_not_using_indexes # # The following can be used as easy to replay backup logs or for replication. # note: if you are setting up a replication slave, see README.Debian about # other settings you may need to change. #server-id = 1 #log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 max_binlog_size = 100M #binlog_do_db = include_database_name #binlog_ignore_db = include_database_name # * InnoDB # # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. # Read the manual for more InnoDB related options. There are many! # # * Security Features # # Read the manual, too, if you want chroot! # chroot = /var/lib/mysql/ # # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". # # ssl-ca=/etc/mysql/cacert.pem # ssl-cert=/etc/mysql/server-cert.pem # ssl-key=/etc/mysql/server-key.pem [mysqldump] quick quote-names max_allowed_packet = 16M [mysql] #no-auto-rehash # faster start of mysql but no tab completition [isamchk] key_buffer = 16M # # * IMPORTANT: Additional settings that can override those from this file! # The files must end with '.cnf', otherwise they'll be ignored. # !includedir /etc/mysql/conf.d/
默认情况下,这个MySQL容器只允许从本地主机连接:允许来自世界各地的连接,我已经做了:
GRANT ALL PRIVILEGES ON 。 TO'root'@'%'IDENTIFIED BY'password'WITH GRANT OPTION; FLUSH PRIVILEGES;
,我已经通过进口的phpmyadmin我DQL转储
描述你收到了效果:
巨大的延迟,与我不知道是哪个问题,并在随机方式没有办法连接到mysql。没有日志。我的老师说这可能是一个与Docker网络相关的DNS问题。
描述你所期望的结果:
连接到数据库马上,就像在Windows中使用XAMPP
感谢您的回答,特里斯坦我试图用这个新的MySQL容器: 搬运工运行--name一些MySQL的-e MYSQL_ROOT_PASSWORD =传递-p 3307:3306 -d mysql的 那么这一个phpMyAdmin的: 泊坞窗运行':docker run --name myadmin -d --link some-mysql:mysql -p 8686:80 phpmyadmin/phpmyadmin 我已经给MySQL配置文件中的bind_address赋值“0.0.0.0”; 然后我创建了桥接码头网络,我已经连接了tomcat和mysql的容器;然后在hibernate.cfg.xml文件中,我指向:3306/at_db,用户名为“root”,密码为“pass”。但问题依然存在! –
pier92
嗯,我已经给了你4条建议,你已经跟随了前2条,你忽略了最后2条。你越来越近了,只是不要忽视任何。并且不要配置mysql配置,这个图像应该是预配置的。 – Tristan
如果不明确:不要忘记更新你的操作系统和内核,并且不要使用“--link”作为phpmyadmin,如果你在tomcat和mysql之间有“延迟”,你应该看到phpmyadmin和MySQL的。 – Tristan