通过docker安装的db2
查看容器是否开启 进入到容器内部[root@centos ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS POR NAMES 3ee57359b00d ibmcom/db2:11.5.0.0 "/var/db2_setup/lib/…" 23 hours ago Up 10 minutes 22/7/tcp, 0.0.0.0:50000->50000/tcp mydb2 [root@centos ~]# docker exec -ti mydb2 bash -c "su - db2inst1" Last login: Fri Apr 17 01:18:44 UTC 2020 12345 查看使用的端口
[db2inst1@3ee57359b00d ~]$ db2 get dbm cfg|grep SVCENAME TCP/IP Service name (SVCENAME) = db2c_db2inst1 SSL service name (SSL_SVCENAME) = [db2inst1@3ee57359b00d ~]$ cat /etc/services | grep db2c_db2inst1 db2c_db2inst1 50000/tcp db2c_db2inst1_ssl 50001/tcp 123456
使用的端口为50000,没有问题
查看指定的数据库是否存在[db2inst1@3ee57359b00d ~]$ db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias = TRDJ Database name = TRDJ Local database directory = /database/data Database release level = 15.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number =
1234567891011121314151617TRDJ数据库存在
4. 查看宿主机的防火墙
[root@centos ~]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) 12345
防火墙是关闭的
5. 查看宿主机的端口
[root@centos ~]# netstat -anp|grep 50000 tcp6 0 0 :::50000 :::* LISTEN 3941/docker-proxy 12
对应端口被docker占用,目前docker只开启了db2,应该也没有问题。
可以先关闭db2,然后查看端口占用
[root@centos ~]# docker stop mydb2 mydb2 [root@centos ~]# netstat -anp|grep 50000 123
重启db2OK …