通过Hibernate将webapp连接到docker mysql容器的延迟非常大
我正在尝试使用Hibernate、针对ApacheTomcat的XAMPP和mysql服务器将我在Windows上创建的web应用程序移植到Linux,使用Docker 完成以下步骤后,我的web.app的第一个功能是登录/注册表单:在Windows上,所有功能都可以正常工作,但使用容器时,延迟大约为几十分钟。。有时也会有500个http错误通过Hibernate将webapp连接到docker mysql容器的延迟非常大,mysql,tomcat,docker,web-applications,Mysql,Tomcat,Docker,Web Applications,我正在尝试使用Hibernate、针对ApacheTomcat的XAMPP和mysql服务器将我在Windows上创建的web应用程序移植到Linux,使用Docker 完成以下步骤后,我的web.app的第一个功能是登录/注册表单:在Windows上,所有功能都可以正常工作,但使用容器时,延迟大约为几十分钟。。有时也会有500个http错误 docker run-d——名称mysql phpmyadmin-p 127.0.0.1:8686:80-p 127.0.0.1:3306:3306 gr
docker run-d——名称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——名称tomcat8链接——链接mysql phpmyadmin:mysqlphp tomcat:8.0-jre8
然后部署在webapps/文件夹my warfile下# 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/
立即连接到数据库,就像在使用XAMPP的Windows中一样,您应该尽量使您的设置成为标准设置,以避免由于非标准做法而导致的错误
- 使用官方或至少流行的图像(数百万次拉取),而不是mysql phpmyadmin的100次拉取:
- 我不知道为什么要用主机端口和容器端口声明ip,如果没有必要,可能不这样做,只发布主机端口和容器端口,而不是ip
- 不要使用--link,因为它是,创建一个网桥网络并使用--network my bridge network运行每个容器
- 使用适用于此LTS版本的最新可用“HWE”内核将Ubuntu升级到最新的LTS版本(16.04.2)(您必须使用单独的命令升级内核,如下所述:
sudo apt get install--install建议xserver-xorg-HWE-16.04