技术交流QQ群:①185473046   ②190706903   ③203744115   网站地图
登录

下次自动登录
现在位置 >首页 > 数据库
0℃
1、在数据量小(1-2GB大小)的情况下可以直接使用pg_dump导出数据,psql导入数据,如下: #导出数据 nohup /data/server/pgsql/bin/pg_dump -h 127.0.0.1 -U dbuser -p 5432 database --column-inserts | gzip > /tmp/database_back.sql.gz & #导入数据 nohup gunzip -c /tmp/database_back.sql.gz | psql -h 127.0.0.1 -U dbuser -d database & 如果数据量比较大(10GB以上),导出数据至少需要2个小时以上,导入数据需要15个小时以上。 2、使用多线程并行导出导入数据 #多线程导出数据 -j 16 16可以...
阅读全文
0℃
2023年06月09日 Redis ⁄ 被围观 1,949次+
操作系统:CentOS-7.x Redis版本:5.0.14 服务器ip:192.168.21.100、192.168.21.101、192.168.21.128 部署说明:使用3台服务器,每台服务器启动2个redis服务,总共6个节点,3主3从组成redis集群 IP地址                       端口          角色  192.168.21.100         6379         redis-master 192.168.21.100         6380         redis-slave 192.168.21.101         6379         redis-master 192.168.21.101         6380         redis-slave 192.168.21.128         6379         redis-master 19...
阅读全文
0℃
2023年05月25日 openGauss ⁄ 被围观 3,038次+
openGauss是由华为开源的一款关系型数据库,基于PostgreSQL数据库开发。 操作系统:openEuler 22.03 LTS SP1 官方网站:https://opengauss.org/zh/ 下载地址:https://opengauss.org/zh/download/ 注意:需要登录才能下载,要选择好操作系统和数据库对应的版本,这里我们选择openEuler 22.03对应的openGauss_5.0.0 企业版openGauss-5.0.0-openEuler-64bit-all.tar 操作系统安装: openEuler 22.03 LTS SP1安装配置图解教程 https://www.osyunwei.com/archives/13673.html 准备篇 1、关闭SELINUX vi /etc/selinux/...
阅读全文
0℃
2022年12月27日 openGauss ⁄ 被围观 3,173次+
openGauss是由华为开源的一款关系型数据库,基于PostgreSQL数据库开发。 操作系统:CentOS 7.x 官方网站:https://opengauss.org/zh/ 下载地址:https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/x86/openGauss-3.1.0-CentOS-64bit-all.tar.gz 安装前系统设置 1、关闭SELINUX vi /etc/selinux/config #SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加 :wq! #保存退出 setenforce 0 #使配置立即生效 2、开启防火墙5432端口 CentOS 7.x默认使用的是firewall作为防火墙...
阅读全文
0℃
2022年09月02日 MySQL ⁄ 被围观 3,086次+
操作系统:CentOS 7.x MySQL二进制版本:5.7.x 小版本升级 现有版本:MySQL 5.7.38 升级后版本:MySQL 5.7.39 下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz 上传mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz到/usr/local/src 升级前先查看MySQL 5.7.x 中添加、弃用或删除的变量和选项 https://dev.mysql.com/doc/refman/5.7/en/added-deprecated-removed.html ############################################ MySQL 8.0.x版本可以使用mysql-shell进行升级前...
阅读全文
0℃
2022年08月04日 Redis ⁄ 被围观 3,122次+
准备篇 一、防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 systemctl mask firewalld systemctl stop firewalld yum remove firewalld 2、安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑防火墙配置文件 # sample configuration for iptables service # you can edit this manually or use system-c...
阅读全文
0℃
2022年08月04日 Redis ⁄ 被围观 2,624次+
Redis安装目录:/usr/local/redis-5.0.14/ #创建日志切割脚本 vi /usr/local/redis-5.0.14/cut-redis-log.sh #!/bin/bash #获取昨天的日期 file_date=$(date -d"1 day ago" +"%Y%m%d") #redis日志文件 log_path_redis=/usr/local/redis-5.0.14/log/redis.log #日志切割后的存放目录 back_base=/usr/local/redis-5.0.14/log/ #设置删除多少天之前的日志文件 days=180 #切割日志 #redis的日志文件可以直接mv,不需要重新加载服务就能生成新的日志文件 mv $log_path_redis $back_base/redis_$file_date.log #删除日...
阅读全文
0℃
2022年07月26日 Redis ⁄ 被围观 2,279次+
准备篇 一、防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 systemctl mask firewalld systemctl stop firewalld yum remove firewalld 2、安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑防火墙配置文件 # sample configuration for iptables service # you can edit this manually or use system-c...
阅读全文
0℃
2022年07月25日 Redis ⁄ 被围观 2,612次+
准备篇 一、防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 systemctl mask firewalld systemctl stop firewalld yum remove firewalld 2、安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑防火墙配置文件 # sample configuration for iptables service # you can edit this manually or use system-c...
阅读全文
0℃
2022年06月28日 PostgreSQL ⁄ 被围观 6,341次+
说明: 1、PostgreSQL 使用 pg_dump 和 pg_dumpall 进行数据库的逻辑备份,使用 psql 和 pg_restore 导入数据; 2、pg_dump 可以选择一个数据库或者部分表进行备份,pg_dumpall是对整个数据库集群进行备份; 3、psql恢复SQL文本格式的数据备份,pg_restore恢复自定义格式的数据备份。 数据库用户:dbuser 数据库:testdb 数据表:new_test,tb_test,testdb 数据库安装路径:/usr/local/pgsql/bin/ mkdir -p /data/backup #创建备份文件存放目录 chown postgres.postgres -R /data/backup su - postgres 一、Post...
阅读全文
0℃
2022年06月26日 PostgreSQL ⁄ 被围观 3,155次+
操作系统:CentOS-7.6 主节点:192.168.21.100 从节点:192.168.21.101 PostgreSQL版本:postgresql-11.13.tar.gz 下载地址:https://ftp.postgresql.org/pub/source/v11.13/postgresql-11.13.tar.gz PostgreSQL数据库的主从同步是一种高可用解决方案,可以实现读写分离。 一、基础配置 在主从服务器上都进行操作 1、防火墙配置 CentOS 7.x 8.x 默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1.1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.serv...
阅读全文
0℃
2022年06月04日 PostgreSQL ⁄ 被围观 2,992次+
PostgreSQL是一个功能非常强大的、源代码开放的关系型数据库,PostgreSQL被业界誉为“最先进的开源数据库”,主要面向企业复杂查询SQL的OLTP业务场景, 支持NoSQL数据类型(hstore/JSON/XML) 一、防火墙配置 CentOS 7.x 8.x 默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 systemctl mask firewalld systemctl stop firewalld yum remove firewalld 2、安装iptables防...
阅读全文
0℃
2021年11月09日 MySQL ⁄ 被围观 3,826次+
准备篇 一、防火墙配置 #防火墙请根据个人需求进行选择和设置,下面以iptables防火墙为例 CentOS 8.x默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 systemctl mask firewalld systemctl stop firewalld yum remove firewalld 2、安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑防火墙配置文件 # sample configuration for...
阅读全文
0℃
本文CentOS版本:CentOS 8.0.1905 MySQL版本:mysql-8.0.18 前传: CentOS 8.0.1905系统安装配置图解教程 https://www.osyunwei.com/archives/10256.html 准备篇 一、防火墙配置 CentOS 从7.x开始默认使用的是firewall作为防火墙,这里改为iptables防火墙。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 systemctl mask firewalld systemctl stop firewalld yum remove firewalld 2、安装iptables防火墙 yum install iptables-...
阅读全文
0℃
2019年06月19日 MySQL ⁄ 被围观 17,129次+
遇到问题:按照MySQL5.6版本之前的语句对MySQL5.7版本执行创建数据库、添加用户并对用户授权操作后,有可能该授权用户只能连接到数据库,但是执行不了任何操作,更是创建不了数据表。 解决问题:通过测试,发现在MySQL5.7版本中,可能要授权用户对所有数据库有SUPER权限,否则可能该授权用户只能连接数据库并不能执行任何操作。 数据库名称:mydb 数据库用户名:mydbuser 数据库密码:123456 Create DATABASE IF NOT EXISTS mydb default charset utf8 COLLATE utf8_general_ci; #创建数据库 #MySQL5.7版本建议先...
阅读全文
0℃
2018年04月30日 MySQL ⁄ 被围观 49,087次+
问题: MySQL数据库迁移到MySQL5.7版本后,出现如下报错: 原因分析:MySQL5.7版本默认设置了 mysql sql_mode = only_full_group_by 属性,导致报错。 解决办法: 1、打开MySQL数据库控制台 执行全局sql语句: set   @@sql_mode= 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; 或者 SET GLOBAL  sql_mode= 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER,NO_ENGINE_SUBS...
阅读全文
0℃
2016年10月08日 MySQL ⁄ 被围观 23,974次+
说明: 开启MySQL binlog日志的服务器,如果不设置自动清理日志,默认binlog日志一直保留着,时间一长,服务器磁盘空间被binlog日志占满,导致MySQL数据库出错。 使用下面方法可以安全清理binlog日志 一、没有主从同步的情况下清理日志 mysql -uroot -p123456 -e 'PURGE MASTER LOGS BEFORE DATE_SUB( NOW( ),INTERVAL 5 DAY)'; #mysql 定时清理5天前的binlog mysql -u root -p  #进入mysql 控制台 reset master;  #重置binlog 二、MySQL主从同步下安全清理binlog日志 1、mysql  -u root -p   #进入从服务器mysql...
阅读全文


Copyright© 2011-2024 系统运维 All rights reserved
版权声明:本站所有文章均为作者原创内容,如需转载,请注明出处及原文链接
陕ICP备11001040号-3