- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想通过 HomeBrew 升级一些东西,但它似乎破坏了我的 Postgres。
我在使用 MacOS。我需要能够再次运行我的 Postgres。在没有备份的情况下删除不是什么大问题:这是本地开发设置。
我跑了:
brew 更新
brew 升级
哪个输出:
==> Upgrading 10 outdated packages:
postgresql 13.3 -> 14.1_1
==> Upgrading postgresql
13.3 -> 14.1_1
==> Pouring postgresql--14.1_1.monterey.bottle.tar.gz
==> Caveats
To migrate existing data from a previous major version of PostgreSQL run:
brew postgresql-upgrade-database
This formula has created a default database cluster with:
initdb --locale=C -E UTF-8 /usr/local/var/postgres
For more details, read:
https://www.postgresql.org/docs/14/app-initdb.html
To restart postgresql after an upgrade:
brew services restart postgresql
Or, if you don't want/need a background service you can just run:
/usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres
==> Summary
🍺 /usr/local/Cellar/postgresql/14.1_1: 3,304 files, 43.9MB
==> Running `brew cleanup postgresql`...
Removing: /usr/local/Cellar/postgresql/13.3... (3,230 files, 42.7MB)
==> Casks with 'auto_updates true' or 'version :latest' will not be upgraded; pass `--greedy` to upgrade them.
==> Upgrading 2 outdated packages:
pgadmin4 5.2 -> 6.2
visualvm 2.0.7 -> 2.1.1
==> Upgrading pgadmin4
==> Downloading https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v6.2/macos/pgadmin4-6.2.dmg
######################################################################## 100.0%
==> Backing App 'pgAdmin 4.app' up to '/usr/local/Caskroom/pgadmin4/5.2/pgAdmin 4.app'
==> Removing App '/Applications/pgAdmin 4.app'
==> Moving App 'pgAdmin 4.app' to '/Applications/pgAdmin 4.app'
==> Purging files for version 5.2 of Cask pgadmin4
🍺 pgadmin4 was successfully upgraded!
==> Upgrading visualvm
==> Caveats
visualvm requires Java. You can install the latest version with:
brew install --cask temurin
==> Downloading https://github.com/oracle/visualvm/releases/download/2.1.1/VisualVM_211.dmg
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/68017978/68ae1458-d0e0-40f3-b429-1dec7eb5b703?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211208%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211208T200243Z&X-Amz-Expires=300&X-Amz-Signature=e33c4cfaaba1afeb72a08a34daed39b82de9ebc342
######################################################################## 100.0%
==> Backing App 'VisualVM.app' up to '/usr/local/Caskroom/visualvm/2.0.7/VisualVM.app'
==> Removing App '/Applications/VisualVM.app'
==> Moving App 'VisualVM.app' to '/Applications/VisualVM.app'
==> Purging files for version 2.0.7 of Cask visualvm
🍺 visualvm was successfully upgraded!
==> Caveats
==> postgresql
To migrate existing data from a previous major version of PostgreSQL run:
brew postgresql-upgrade-database
This formula has created a default database cluster with:
initdb --locale=C -E UTF-8 /usr/local/var/postgres
For more details, read:
https://www.postgresql.org/docs/14/app-initdb.html
To restart postgresql after an upgrade:
brew services restart postgresql
Or, if you don't want/need a background service you can just run:
/usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres
==> visualvm
visualvm requires Java. You can install the latest version with:
brew install --cask temurin
然后当我尝试用通常的方式运行我的 Postgres 服务器时
pg_ctl -D /usr/local/var/postgres start
我会得到
waiting for server to start....2021-12-08 23:44:24.182 EST [17879] FATAL: database files are incompatible with server
2021-12-08 23:44:24.182 EST [17879] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.
stopped waiting
pg_ctl: could not start server
Examine the log output.
然后使用
tail -n 10 /usr/local/var/log/postgres.log
我明白了
2021-12-08 23:30:30.897 EST [15687] FATAL: database files are incompatible with server
2021-12-08 23:30:30.897 EST [15687] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.
2021-12-08 23:30:40.982 EST [15949] FATAL: database files are incompatible with server
2021-12-08 23:30:40.982 EST [15949] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.
2021-12-08 23:30:51.066 EST [15954] FATAL: database files are incompatible with server
2021-12-08 23:30:51.066 EST [15954] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.
2021-12-08 23:31:01.154 EST [15960] FATAL: database files are incompatible with server
2021-12-08 23:31:01.154 EST [15960] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.
2021-12-08 23:31:11.227 EST [16453] FATAL: lock file "postmaster.pid" already exists
2021-12-08 23:31:11.227 EST [16453] HINT: Is another postgres (PID 16451) running in data directory "/usr/local/var/postgres"?
如您所见,时间戳不匹配。那实际上是因为我也一直在尝试用
启动服务brew services start postgres
这就是一直在那里输出日志的进程。
如果我查看 /usr/local/Cellar
,我会看到:
drwxr-xr-x 3 i548042 admin 96 8 Dec 23:15 postgresql
drwxr-xr-x 3 i548042 admin 96 8 Dec 23:29 postgresql@13
看来哪里不对。
psql --version
是否输出
psql (PostgreSQL) 14.1
如果我运行 HomeBrew 的建议
brew postgresql-upgrade-database
我得到:
==> Upgrading postgresql data from 13 to 14...
waiting for server to start....2021-12-08 23:48:02.918 EST [18573] LOG: starting PostgreSQL 13.5 on x86_64-apple-darwin21.1.0, compiled by Apple clang version 13.0.0 (clang-1300.0.29.3), 64-bit
2021-12-08 23:48:02.920 EST [18573] LOG: listening on IPv6 address "::1", port 5432
2021-12-08 23:48:02.920 EST [18573] LOG: listening on IPv4 address "127.0.0.1", port 5432
2021-12-08 23:48:02.921 EST [18573] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2021-12-08 23:48:02.933 EST [18574] LOG: database system was shut down at 2021-12-08 23:31:28 EST
2021-12-08 23:48:02.939 EST [18573] LOG: database system is ready to accept connections
done
server started
waiting for server to shut down...2021-12-08 23:48:03.275 EST [18573] LOG: received fast shutdown request
.2021-12-08 23:48:03.275 EST [18573] LOG: aborting any active transactions
2021-12-08 23:48:03.276 EST [18573] LOG: background worker "logical replication launcher" (PID 18580) exited with exit code 1
2021-12-08 23:48:03.276 EST [18575] LOG: shutting down
2021-12-08 23:48:03.285 EST [18573] LOG: database system is shut down
done
server stopped
==> Moving postgresql data from /usr/local/var/postgres to /usr/local/var/postgres.old...
==> Creating database...
The files belonging to this database system will be owned by user "i548042".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /usr/local/var/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... America/Toronto
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/usr/local/opt/postgresql/bin/pg_ctl -D /usr/local/var/postgres -l logfile start
==> Migrating and upgrading data...
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
Checking database user is the install user ok
Checking database connection settings ok
Checking for prepared transactions ok
Checking for system-defined composite types in user tables ok
Checking for reg* data types in user tables ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for user-defined encoding conversions ok
Checking for user-defined postfix operators ok
Creating dump of global objects ok
Creating dump of database schemas
ok
Checking for presence of required libraries fatal
Your installation references loadable libraries that are missing from the
new installation. You can add these libraries to the new installation,
or remove the functions using them from the old installation. A list of
problem libraries is in the file:
loadable_libraries.txt
Failure, exiting
Error: Upgrading postgresql data from 13 to 14 failed!
==> Removing empty postgresql initdb database...
==> Moving postgresql data back from /usr/local/var/postgres.old to /usr/local/var/postgres...
Error: Failure while executing; `/usr/local/opt/postgresql/bin/pg_upgrade -r -b /usr/local/Cellar/postgresql@13/13.5_1/bin -B /usr/local/opt/postgresql/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres -j 16` exited with 1.
按照建议去做
/usr/local/opt/postgresql/bin/pg_ctl -D /usr/local/var/postgres -l logfile start
给我
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
所以我再次使用命令查看日志。同样的事情:
2021-12-08 23:49:45.779 EST [18758] FATAL: database files are incompatible with server
2021-12-08 23:49:45.779 EST [18758] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.
我还尝试了许多不同的其他解决方案,例如 brew uninstall
和 brew install
的组合,用于 postgres
和 postgresql@13
,并且还在网上寻找一种在版本 13 上手动安装 psql
的方法,因为这似乎是这里的罪魁祸首。
然后我继续尝试通过删除并重新创建它来弄乱 ~/Library/LaunchAgents
中的符号链接(symbolic link)(我很可能在那个时候也弄乱了一些东西,但事情是事先已经坏了)。
无论如何,所有这一切都在说:这非常烦人,我不明白我能做些什么才能最终再次启动 Postgres。
我不关心版本,也不关心丢失数据库上的数据。如果我需要删除文件夹,我会的。我已经有相关信息的转储,无论如何这是一个本地开发环境,而不是生产环境。
最佳答案
这帮助了我:https://blog.testdouble.com/posts/2021-01-28-how-to-completely-uninstall-homebrew-postgres/
$ brew uninstall postgres
$ rm -rf /usr/local/var/postgres
$ rm /usr/local/var/log/postgres.log
$ rm -f ~/.psqlrc ~/.psql_history
它正确地卸载了 postgres,然后您可以使用 brew install postgres
重新安装它。
注意:这会破坏您所有的 Postgres 数据。
关于postgresql - brew upgrade postgresql 损坏的 psql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70284900/
我的 postgresql 有问题,我复制了所有文件,然后将其删除。然后,我安装了新的,问题就解决了。现在可以将旧文件和文件导入新文件吗? 最佳答案 如果它们是相同的主要版本(即 9.0 到 9.0.
我想使用 Postgresql 9.2.2 来存储我的应用程序的数据。我不得不构建一个应该基于数据库级别的触发器(当数据库启动时,这个触发器将被触发并执行。),当 postgresql 服务器启动时是
我已经使用下面的查询从 Postgresql 目录表中获取 Sequence 对象的完整信息 select s.sequence_name, s.start_value, s.minimum_valu
Postgres 版本:9.3.4 我需要执行驻留在远程数据库中的函数。该函数根据给定的参数返回一个统计数据表。 我实际上只是在我的本地数据库中镜像该函数,以使用我的数据库角色和授权来锁定对该函数的访
我在 CentOS 7 上,我正在尝试解决“PG::ConnectionBad: FATAL: Peer authentication failed for user”错误。 所以我已经想出我应该更改
我写了一个触发器函数,在触发器表列名上循环,我从具有不同列的不同表调用该函数。该函数将列名插入到数组中并在它们上循环,以便将值插入到另一个模式和表中。 函数和触发器创建脚本: DROP TRIGGER
PostgreSQL 的默认空闲连接超时是多少,我运行了 show idle_in_transaction_session_timeout 查询并返回了 0,但是值 0 表示此选项被禁用,但我想知道默
我需要将十六进制值存储到数据库表中,谁能推荐我需要用于属性的数据类型? 提前致谢 最佳答案 您可以使用bytea 来存储十六进制格式。更多信息 can be found in the postgres
我有一个具有复合主键的(大)表,由 5 列(a、b、c、d、e)组成。 我想高效地选择具有其中两列 (a + e) 的所有行到给定值。 在 PostgreSQL 中,我需要索引吗?或者数据库会使用主键
在阅读 PostreSQL (13) 文档时,我遇到了 this页面,其中列出了不同日期时间类型的存储大小。 除其他外,它指出: Name Storag
我有两个大整数的巨大表(500 000 000 行)。两列都被单独索引。我正在使用语法批量插入此表: INSERT into table (col1, col2) VALUES(x0, y0), (x
有一台 CentOS7 Linux 机器正在运行(不是由我管理;拥有有限的权限)。 请求在其中设置 PostgreSQL。 刚刚从 CentOS 存储库安装了 PostgreSQL: sudo yum
我在 Ubuntu 18.04 上安装了 Postgresql 10,但不知何故坏了,不会重新启动。我可以重新安装它而不破坏它的数据库,以便我可以再次访问数据库吗? pg_dump 不起作用。 最佳答
我想在 UNIX 中使用 crontab 自动备份 PostgreSQL 数据库。我已经尝试过,但它会创建 0 字节备份。 我的 crontab 条目是: 24 * * * * /home/desk
我已经完成了PG服务器的安装。我希望能够使用 pgAdmin 远程连接到它,但不断收到服务器不听错误。 could not connect to server: Connection refused
Oracle 支持波斯历但需要知道 PostgreSQL 是否支持波斯历? 如果是,那么我们如何在 PostgreSQL 中将默认日历类型设置为 Persian 而不是 Gregorian(在 Ora
假设我们有一个带有表的 SQL 数据库 Person以及访问它的几个应用程序。出于某种原因,我们想修改 Person表以向后不兼容的方式。 保持兼容性的一种潜在解决方案是将表重命名为 User并创建一
我使用 PostgreSQL 中的模式来组织我庞大的会计数据库。每年年底,我都会通过为下一年创建一个新模式来进行协调过程。 新模式的文件是否与旧模式物理分离?或者所有模式一起存储在硬盘上? 这对我来说
我正在尝试使用配置文件中的以下配置参数调整 PostgreSQL 服务器: autovacuum_freeze_max_age = 500000000 autovacuum_max_workers =
我的数据包含数据库列中的表情符号,即 message_text ------- 🙂 😀 Hi 😀 我只想查询包含表情符号的数据的行。在 postgres 中是否有一种简单的方法可以做到这一点?
我是一名优秀的程序员,十分优秀!