Linux随记(二十八)

一、postgreSQL 14.4 单机版 - 更改pg存储数据路径- 记录

shell 复制代码
xx ip 更换pg 数据盘data 操作 【由于 / 快爆满,需要将原pg data数据 迁移到/data盘下】
#当前pg data路径是 /home/postgres/postgis/postgresql/data  【该文件夹占用容量65gb】

###当前的pg启动信息:
[root@xx-022 data]# ps -ef | grep postgre
postgres 1495421       1  0  2025 ?        00:03:25 /home/postgres/postgis/postgresql/bin/postgres -D /home/postgres/postgis/postgresql/data
postgres 1495423 1495421  0  2025 ?        00:04:17 postgres: checkpointer 
postgres 1495424 1495421  0  2025 ?        00:01:14 postgres: background writer 
postgres 1495425 1495421  0  2025 ?        00:01:33 postgres: walwriter 

更改操作:

shell 复制代码
#注意,如果/home/postgres/postgis/postgresql/data/postgresql.conf有写了相关的 data_directory,则需要更改。
su - postgres
#先处理以前的旧data数据
cd /data/postgres
mv data  data_bakOld

### 0、全备
mkdir -p /data/pg_backup

export PGPASSWORD='xxxxxx'
#备份耗时约40分钟。
pg_dumpall -h 127.0.0.1 -U postgres | gzip -c > /data/pg_backup/pg_dumpall_full_$(date +%F_%H%M).sql.gz

### 1、停止Pg
/home/postgres/postgis/postgresql/bin/pg_ctl -D /home/postgres/postgis/postgresql/data  stop -m fast


### 2、移动 , 做软连 
cd /home/postgres/postgis/postgresql
#耗时约20分钟
mv  data  /data/postgres
#查看数据信息
ls -l /data/postgres

ln  -s /data/postgres/data  /home/postgres/postgis/postgresql/data 
#查看软连信息
ls -l 


### 3、启动pg
/home/postgres/postgis/postgresql/bin/postgres -D /home/postgres/postgis/postgresql/data &

###  4、验证服务
pgrep -l postgres
sudo -u postgres psql -c "\l+"
sudo -u postgres psql -c "SELECT COUNT(*) FROM pg_database;"

### 5、验证postgis功能
postgres=# \dx postgis*

CREATE TABLE test_points (
  id serial PRIMARY KEY,
  name varchar,
  geom geometry(Point, 4326)
);
####
INSERT INTO test_points(name, geom)
VALUES ('A', ST_SetSRID(ST_MakePoint(116, 39), 4326)),
       ('B', ST_SetSRID(ST_MakePoint(121, 31), 4326));
	   
###
SELECT a.name, b.name,
       ST_Distance(a.geom::geography, b.geom::geography)/1000 AS km
FROM test_points a, test_points b
WHERE a.id < b.id;

END

二、Windows server 2012的远程控制服务3389端口的漏洞 - 随记

shell 复制代码
##与远程桌面控制 3389端口相关的漏洞:
SSL/TLS协议信息泄露漏洞(CVE-2016-2183)【原理扫描】
MicrosoftWindowsCredSSP远程执行代码漏洞(CVE-2018-0886)【原理扫描】
SSL/TLS受诫礼(BAR-MITZVAH)攻击漏洞(CVE-2015-2808)【原理扫描】
SSL/TLSRC4信息泄露漏洞(CVE-2013-2566)【原理扫描】
MicrosoftWindows远程桌面协议中间人攻击漏洞(CVE-2005-1794)【原理扫描】
SSL证书使用了弱hash算法(CVE-2005-4900)【原理扫描】
远程终端服务未配置为仅使用网络级身份验证(NLA)【原理扫描】
相关推荐
阿里云大数据AI技术21 小时前
阿里云 EMR AI 助手正式发布:从问答工具到全栈智能运维助手
运维·人工智能
你好潘先生1 天前
别再记命令了,用 yeero do 说句人话就能跑脚本,而且不烧 token
服务器·python·命令行
orion572 天前
Missing Semester Class1:course overview and introduction of shell
linux
SkyWalking中文站2 天前
认识 Horizon UI · 6/17:Trace 探索器
运维·监控·自动化运维
用户120487221612 天前
Linux驱动编译与加载
linux·嵌入式
程序员老赵2 天前
服务器文件不想 SFTP 上传?Docker 跑个 File Browser,浏览器就能管理
服务器·docker·开源
火车叼位2 天前
写给初级开发者:SSL、SSH、HTTPS 与证书体系全解析
运维
vivo互联网技术2 天前
从 10 分钟到 1 秒:ES 深度分页任意跳页的三轮优化实战
服务器·数据库·redis·elasticsearch·深度分页
用户805533698032 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式