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)【原理扫描】
相关推荐
熠速1 天前
CI/CD功能介绍
运维·ci/cd
李长渊哦1 天前
Nginx 反向代理实战:解决 IPv6 报错与跨网段访问指南
运维·nginx
信创工程师-小杨1 天前
银河麒麟SP3如何离线部署二进制docker
运维·docker·容器
小疙瘩1 天前
本文记录Windows11安装Docker(Docker Desktop)的详细步骤
运维·docker·容器
渔民小镇1 天前
不止 request/response —— ionet 的 4 种通信模型选型指南
java·服务器·游戏
沐伊~1 天前
LINUX基础篇(Ubuntu):
linux·运维·服务器
艾莉丝努力练剑1 天前
System V IPC底层原理详解
linux·运维·服务器·网络·c++·人工智能·学习
顶点多余1 天前
使用C/C++实现简易版xshell命令行
linux·运维·windows
落羽的落羽1 天前
【Linux系统】信号机制拆解,透过内核三张表深入本质
android·java·linux·服务器·c++·spring·机器学习
ricky_fan1 天前
(最新版)Cluade code安装、部署教程-Mac
linux·编辑器·vim