摘要: jsonb与json的差异 jsonb:存储格式为二进制,二进制文件是已解析好的数据,检索jsonb时不需要重新解析 json:存储格式为文本,检索json时必须重新解析 对json数据的操作: postgres=# create table test_json1 (id serial primar 阅读全文
posted @ 2021-10-14 14:06 罗论明 阅读(583) 评论(0) 推荐(0) 编辑
摘要: \timing 打开或关闭sql执行时间 \watch [seconds] 反复执行上一句sql命令 阅读全文
posted @ 2021-10-13 22:03 罗论明 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 编辑cat ~/.psqlrc文件 添加脚本 [postgres@localhost ~]$ cat ~/.psqlrc \set active_session ' select pid,usename,datname,query,client_addr from pg_stat_activity 阅读全文
posted @ 2021-10-13 21:55 罗论明 阅读(112) 评论(0) 推荐(0) 编辑
摘要: --编写test_2.sql脚本 [postgres@localhost ~]$ cat test_2.sql select * from test_2 where id=:v_id; 通过-v传递参数 [postgres@localhost ~]$ psql -v v_id=1 -f test_2 阅读全文
posted @ 2021-10-13 21:42 罗论明 阅读(394) 评论(0) 推荐(0) 编辑
摘要: --编写脚本文件 [postgres@localhost ~]$ cat test_2.sqlcreate table test_2(id int4);insert into test_2 values (1);insert into test_2 values (2);insert into te 阅读全文
posted @ 2021-10-13 21:28 罗论明 阅读(304) 评论(0) 推荐(0) 编辑
摘要: --创建用户,创建空间目录,创建数据库,赋权 postgres=# create role pguser with password 'pguser'; CREATE ROLE [root@localhost ~]# mkdir -p /database/pg10/pg_tbs/tbs_mydb r 阅读全文
posted @ 2021-10-13 16:59 罗论明 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 使用pg_ctl方式进行管理 1.数据库的启动,查看状态,关闭 [root@localhost ~]# su - postgres Last login: Tue Oct 12 23:34:33 EDT 2021 on pts/1 [postgres@localhost ~]$ /opt/pgsql 阅读全文
posted @ 2021-10-13 13:45 罗论明 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 1.源码编译安装 下载地址:https://www.postgresql.org/ftp/source/v10.0/解压 tar -zxvf postgresql-10.0.tar.gz 2.准备好编译环境和安装包 yum groupinstall "Development tools" yum i 阅读全文
posted @ 2021-10-13 11:40 罗论明 阅读(99) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash LIMIT=30 #这边可以自定义限制次数 LOGFILE="/var/log/block_ssh.log" #日志路径 TIME=$(date '+%b %e %H') #example: Apr 11 11 BLOCK_IP=$(grep "$TIME" /var/log 阅读全文
posted @ 2021-09-28 10:12 罗论明 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 创建用户 useradd 用户名 添加密码 passwd 用户名 用户登录后发现pwd发现新建用户根目录在/home下 将pgxz用户根目录改到/data/pgxz usermod -md /data/pgxz -u 1001 pgxz 移动用户下所有文件 cp /home/pgxz/* /data 阅读全文
posted @ 2021-08-14 13:25 罗论明 阅读(354) 评论(0) 推荐(0) 编辑