说明(发布前可手动删除说明内容):
- 发布话题前请确认好标题与标签、确认你已经看过了论坛准则:论坛准则 - 社区论坛 - FIT2CLOUD 飞致云 ;
-
如有必要请附带以下信息:1Panel 版本、运行方式(安装包运行 or 源码运行 )、浏览器版本、更多描述或截图信息。
postgresql 怎么降级呢? 使用商店安装的默认是16,也无法选择版本,因为的其他服务器用的是14版本,无法到会恢复备份,一直报错,不知道是不是我的问题
另外只能命令安装 postgis 么?
说明(发布前可手动删除说明内容):
另外只能命令安装 postgis 么?
应用参数>高级设置>编辑compose文件,修改镜像版本就可以更换版本
如果有现有的数据库,就不建议更换了
为什么无法从外部连接数据库呢?
1、创建的时候,我开启了外部访问
2、防火墙处增加了tcp 和端口 5432
3、postgresql 编辑容器,我选了暴露所有
防火墙:
tcp | 5432 | 已使用 (postgresql) | 允许 | 所有 IP | 编辑删除 | |
---|---|---|---|---|---|---|
udp | 5432 | 已使用 (postgresql) | 允许 | 所有 IP |
暴露所有
网络 1panel-network
ipv4 172.18.0.3
ipv6
看看外部端口是否真正开放
公网服务
局域网就curl测试下
我用的虚拟机装的,然后用内网ip 无法连接, 如果在服务器内使用pgadmin4 然后利用docker名称就可以连接,然后电脑用 Navicat Premium 无法连接,我是输出了 内网IP+5432
另外:请问如何安装postgis ? 本论坛没有这个关键词的内容
没有公网IP, 家庭宽带
仔细看看端口有没有真正开放,容器页面的容器端口是0.0.0.0:端口么
应该是开放了,因为我能访问 pgAdmin4 网页版
我是linux 版本
IP为:192.168.x.x
使用 Xshell ssh 也能连接服务器
这里
{
“Id”: “af56289e8b9a216054014bf869413bb72579bc9f2e8ee60d93de2615b27d8967”,
“Created”: “2024-06-03T03:48:41.419619205Z”,
“Path”: “docker-entrypoint.sh”,
“Args”: [
“postgres”
],
“State”: {
“Status”: “running”,
“Running”: true,
“Paused”: false,
“Restarting”: false,
“OOMKilled”: false,
“Dead”: false,
“Pid”: 25183,
“ExitCode”: 0,
“Error”: “”,
“StartedAt”: “2024-06-03T03:48:41.644782918Z”,
“FinishedAt”: “0001-01-01T00:00:00Z”,
“Health”: {
“Status”: “healthy”,
“FailingStreak”: 0,
“Log”: [
{
“Start”: “2024-06-02T23:49:11.64679928-04:00”,
“End”: “2024-06-02T23:49:11.69212676-04:00”,
“ExitCode”: 0,
“Output”: “”
}
]
}
},
“Image”: “sha256:d97701858621e6e9afa18032a666666e52dc38e42737c2e2136b595a08c80e4d”,
“ResolvConfPath”: “/var/lib/docker/containers/af56289e8b9a216054014bf869413bb72579bc9f2e8ee60d93de2615b27d8967/resolv.conf”,
“HostnamePath”: “/var/lib/docker/containers/af56289e8b9a216054014bf869413bb72579bc9f2e8ee60d93de2615b27d8967/hostname”,
“HostsPath”: “/var/lib/docker/containers/af56289e8b9a216054014bf869413bb72579bc9f2e8ee60d93de2615b27d8967/hosts”,
“LogPath”: “/var/lib/docker/containers/af56289e8b9a216054014bf869413bb72579bc9f2e8ee60d93de2615b27d8967/af56289e8b9a216054014bf869413bb72579bc9f2e8ee60d93de2615b27d8967-json.log”,
“Name”: “/1Panel-postgresql-z8C3”,
“RestartCount”: 0,
“Driver”: “overlay2”,
“Platform”: “linux”,
“MountLabel”: “”,
“ProcessLabel”: “”,
“AppArmorProfile”: “”,
“ExecIDs”: null,
“HostConfig”: {
“Binds”: [
“/opt/1panel/apps/postgresql/postgresql/data:/var/lib/postgresql/data:rw”
],
“ContainerIDFile”: “”,
“LogConfig”: {
“Type”: “json-file”,
“Config”: {}
},
“NetworkMode”: “307db16f477c306cb62a7327bb58b9d1de2eeb117cd23b983be155bbec2f9aff”,
“PortBindings”: {},
“RestartPolicy”: {
“Name”: “always”,
“MaximumRetryCount”: 0
},
“AutoRemove”: false,
“VolumeDriver”: “”,
“VolumesFrom”: null,
“ConsoleSize”: [
0,
0
],
“CapAdd”: null,
“CapDrop”: null,
“CgroupnsMode”: “host”,
“Dns”: [],
“DnsOptions”: [],
“DnsSearch”: [],
“ExtraHosts”: [],
“GroupAdd”: null,
“IpcMode”: “private”,
“Cgroup”: “”,
“Links”: null,
“OomScoreAdj”: 0,
“PidMode”: “”,
“Privileged”: false,
“PublishAllPorts”: true,
“ReadonlyRootfs”: false,
“SecurityOpt”: null,
“UTSMode”: “”,
“UsernsMode”: “”,
“ShmSize”: 67108864,
“Runtime”: “runc”,
“Isolation”: “”,
“CpuShares”: 0,
“Memory”: 0,
“NanoCpus”: 0,
“CgroupParent”: “”,
“BlkioWeight”: 0,
“BlkioWeightDevice”: null,
“BlkioDeviceReadBps”: null,
“BlkioDeviceWriteBps”: null,
“BlkioDeviceReadIOps”: null,
“BlkioDeviceWriteIOps”: null,
“CpuPeriod”: 0,
“CpuQuota”: 0,
“CpuRealtimePeriod”: 0,
“CpuRealtimeRuntime”: 0,
“CpusetCpus”: “”,
“CpusetMems”: “”,
“Devices”: null,
“DeviceCgroupRules”: null,
“DeviceRequests”: null,
“MemoryReservation”: 0,
“MemorySwap”: 0,
“MemorySwappiness”: null,
“OomKillDisable”: false,
“PidsLimit”: null,
“Ulimits”: null,
“CpuCount”: 0,
“CpuPercent”: 0,
“IOMaximumIOps”: 0,
“IOMaximumBandwidth”: 0,
“MaskedPaths”: [
“/proc/asound”,
“/proc/acpi”,
“/proc/kcore”,
“/proc/keys”,
“/proc/latency_stats”,
“/proc/timer_list”,
“/proc/timer_stats”,
“/proc/sched_debug”,
“/proc/scsi”,
“/sys/firmware”,
“/sys/devices/virtual/powercap”
],
“ReadonlyPaths”: [
“/proc/bus”,
“/proc/fs”,
“/proc/irq”,
“/proc/sys”,
“/proc/sysrq-trigger”
]
},
“GraphDriver”: {
“Data”: {
“LowerDir”: “/var/lib/docker/overlay2/895c564f2646ed392b456aedf46542dc37c70d8bda12c52e5245cf7a3301b28c-init/diff:/var/lib/docker/overlay2/a67614c3f3b974cac0c09c49db11d0671986cd53216adaecb30b800ad771083b/diff:/var/lib/docker/overlay2/4a6ce91d5a3a82571d92221c77a5db6148adfe06e0e3d488c3daf4a493cea749/diff:/var/lib/docker/overlay2/b606f37524eafa76e5c525100e1731a3da9e0c9f673ef0050cb793694d759eb3/diff:/var/lib/docker/overlay2/29865e0300c19a518d5c2034d5aeb4c7e03d40a72fba71893ebd18de1c151ed8/diff:/var/lib/docker/overlay2/c810def3e0dc1090dc96ada4fd52c671128b8f9a2c338ae9585d24242bc4756e/diff:/var/lib/docker/overlay2/b3032df7fc53c875b08737befefef75b38ba815fadd167aa5ab8da080c6572a3/diff:/var/lib/docker/overlay2/ef5015b254ee369af4c37c96d287a153fb4ef73dbe813a2d706f22ca73ee6233/diff:/var/lib/docker/overlay2/67f810a4e1dd5c6d4ea8d09599138c9f8be2742e6ed9000c5fcc0439c9ef0abf/diff:/var/lib/docker/overlay2/05ca423bac9702a152f4a6bd782872a919d9e8ddfda8e4e342b1e20a77279e55/diff”,
“MergedDir”: “/var/lib/docker/overlay2/895c564f2646ed392b456aedf46542dc37c70d8bda12c52e5245cf7a3301b28c/merged”,
“UpperDir”: “/var/lib/docker/overlay2/895c564f2646ed392b456aedf46542dc37c70d8bda12c52e5245cf7a3301b28c/diff”,
“WorkDir”: “/var/lib/docker/overlay2/895c564f2646ed392b456aedf46542dc37c70d8bda12c52e5245cf7a3301b28c/work”
},
“Name”: “overlay2”
},
“Mounts”: [
{
“Type”: “bind”,
“Source”: “/opt/1panel/apps/postgresql/postgresql/data”,
“Destination”: “/var/lib/postgresql/data”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “rprivate”
}
],
“Config”: {
“Hostname”: “942f1501625f”,
“Domainname”: “”,
“User”: “”,
“AttachStdin”: false,
“AttachStdout”: true,
“AttachStderr”: true,
“ExposedPorts”: {
“5432/tcp”: {}
},
“Tty”: false,
“OpenStdin”: false,
“StdinOnce”: false,
“Env”: [
“POSTGRES_PASSWORD=rootlsl”,
“POSTGRES_USER=postgresql”,
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”,
“LANG=en_US.utf8”,
“PG_MAJOR=16”,
“PG_VERSION=16.3”,
“PG_SHA256=331963d5d3dc4caf4216a049fa40b66d6bcb8c730615859411b9518764e60585”,
“DOCKER_PG_LLVM_DEPS=llvm15-dev \t\tclang15”,
“PGDATA=/var/lib/postgresql/data”
],
“Cmd”: [
“postgres”
],
“Healthcheck”: {
“Test”: [
“CMD”,
“pg_isready”,
“-h”,
“127.0.0.1”,
“-p”,
“5432”,
“-q”,
“-U”,
“postgresql”
],
“Interval”: 30000000000,
“Timeout”: 5000000000,
“StartPeriod”: 20000000000,
“Retries”: 5
},
“Image”: “postgres:16.3-alpine”,
“Volumes”: {
“/var/lib/postgresql/data”: {}
},
“WorkingDir”: “”,
“Entrypoint”: [
“docker-entrypoint.sh”
],
“OnBuild”: null,
“Labels”: {
“com.docker.compose.config-hash”: “e393729ee701a135dd11b64495ef767aa127508932e16f6adb615f9801f57257”,
“com.docker.compose.container-number”: “1”,
“com.docker.compose.depends_on”: “”,
“com.docker.compose.image”: “sha256:d97701858621e6e9afa18032a666666e52dc38e42737c2e2136b595a08c80e4d”,
“com.docker.compose.oneoff”: “False”,
“com.docker.compose.project”: “postgresql”,
“com.docker.compose.project.config_files”: “/opt/1panel/apps/postgresql/postgresql/docker-compose.yml”,
“com.docker.compose.project.working_dir”: “/opt/1panel/apps/postgresql/postgresql”,
“com.docker.compose.service”: “postgresql”,
“com.docker.compose.version”: “2.26.1”,
“createdBy”: “Apps”
},
“StopSignal”: “SIGINT”
},
“NetworkSettings”: {
“Bridge”: “”,
“SandboxID”: “261c20a1377d0099db8336b94c5dd5e250bc052f1590323c1ec526a7930367b2”,
“SandboxKey”: “/var/run/docker/netns/261c20a1377d”,
“Ports”: {
“5432/tcp”: [
{
“HostIp”: “0.0.0.0”,
“HostPort”: “32778”
},
{
“HostIp”: “::”,
“HostPort”: “32778”
}
]
},
“HairpinMode”: false,
“LinkLocalIPv6Address”: “”,
“LinkLocalIPv6PrefixLen”: 0,
“SecondaryIPAddresses”: null,
“SecondaryIPv6Addresses”: null,
“EndpointID”: “”,
“Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“MacAddress”: “”,
“Networks”: {
“1panel-network”: {
“IPAMConfig”: null,
“Links”: null,
“Aliases”: null,
“MacAddress”: “02:42:ac:12:00:03”,
“NetworkID”: “307db16f477c306cb62a7327bb58b9d1de2eeb117cd23b983be155bbec2f9aff”,
“EndpointID”: “a6b5a36d9683793f593e727a08f16b2b4a42594889614bcb0b85ce81ef41f8da”,
“Gateway”: “172.18.0.1”,
“IPAddress”: “172.18.0.3”,
“IPPrefixLen”: 16,
“IPv6Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“DriverOpts”: null,
“DNSNames”: [
“1Panel-postgresql-z8C3”,
“af56289e8b9a”,
“942f1501625f”
]
}
}
}
}
你这个是127 ,我是000 ,就会造成无法访问么? 我看配置没有地方能改这个
好像可以了,我成不是暴露全部,点测试能连接,
这里降级怎么降? 我改成 14.9 但是 重建的时候报错,和16不兼容, 16在那里改成14.9
错误:The data directory was initialized by PostgreSQL version 16, which is not compatible with this version 14.9 (Debian 14.9-1.pgdg120+1).
networks:
1panel-network:
external: true
services:
postgresql:
container_name: ${CONTAINER_NAME}
deploy:
resources:
limits:
cpus: ${CPUS}
memory: ${MEMORY_LIMIT}
environment:
- POSTGRES_USER=${PANEL_DB_ROOT_USER}
- POSTGRES_PASSWORD=${PANEL_DB_ROOT_PASSWORD}
healthcheck:
interval: 30s
retries: 5
start_period: 20s
test:
- CMD
- pg_isready
- -h
- 127.0.0.1
- -p
- “5432”
- -q
- -U
- ${PANEL_DB_ROOT_USER}
timeout: 5s
image: postgres:14.9
labels:
createdBy: Apps
networks:
- 1panel-network
ports:
- ${HOST_IP}:${PANEL_APP_PORT_HTTP}:5432
restart: always
volumes:
- ./data:/var/lib/postgresql/data