Category: Database

Install MariaDB 10.4 + Apache2(httpd) 2.4 + PHP 7.3 on CentOS 7.6

1. 准备 cat /etc/redhat-release # CentOS Linux release 7.6.1810 (Core) 2. 安装MariaDB 10.4 cat | sudo tee /etc/yum.repos.d/mariadb.repo <<EOF [mariadb] name = MariaDB baseurl = https://yum.mariadb.org/10.4/rhel7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF sudo yum install MariaDB-server MariaDB-client sudo systemctl start mariadb sudo systemctl enable mariadb #表名大小写不敏感 sudo sed -i ‘s/\[mysqld\]/[mysqld]\nlower_case_table_names=1/’ /etc/my.cnf sudo mysql_secure_installation Create database. Let’s take wordpress as an example: $ mysql -u root -p MariaDB [(none)]> CREATE DATABASE `wordpress` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; MariaDB [(none)]> grant all on wordpress.*…

Read More »

Oracle 9i &10g编程艺术-深入数据库体系结构

目录 序 前言 目录 配置环境 第一章 开发成功的Oracle应用程序 第2章:体系结构概述 第3章:文件 第4章:内存结构 第5章:Oracle进程 第6章:锁 第7章:并发与多版本 第8章:事务 第9章:redo与undo 第10章:数据库表 第11章:索引 第12章:数据类型 第13章:分区 第14章:并行执行 第15章:数据加载和卸载 原文 http://blog.csdn.net/knowhow?viewmode=contents

Read More »

CentOS 7.2 redis-3.0.5 WARNING solved

启动redis,显示告警如下: 8589:M 05 Dec 14:28:58.509 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 8589:M 05 Dec 14:28:58.509 # Server started, Redis version 3.0.5 8589:M 05 Dec 14:28:58.509 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect. 8589:M…

Read More »

Tuning Linux for MongoDB — 转

Tuning Linux for MongoDB Tim Vaillancourt  | August 12, 2016 |  Posted In: MongoDB In this post, we’ll discuss tuning Linux for MongoDB deployments. By far the most common operating system you’ll see MongoDB running on is Linux 2.6 and 3.x. Linux flavors such as CentOS and Debian do a fantastic job of being a stable, general-purpose operating system. Linux runs software on hardware ranging from tiny computers like the Raspberry Pi up to massive data center servers. To make this flexibility work,…

Read More »

mongodb 3.2.11 副本集 安装日志 主从仲裁

==================================================== 系统环境: CentOS release 6.2+ 安装软件: mongodb-linux-x86_64-rhel62-3.2.11.tgz 一、mongodb3 副本集规划 副本集名称: testrs (项目中根据实际情况修改) 以 192.168.100.x 为例 1.1 集群规划 192.168.100.1:27017 主 192.168.100.2:27017 从 192.168.100.3:27017 仲裁 – 不保存业务数据,节约硬盘空间 1.2 服务器目录规划 /home/mongodb3 mongodb-home目录 |_ bin 命令目录 |_ conf 配置目录 |_ data 数据目录 – 可建立符号链接 指向nas/其他目录 |_ master 主 |_ slaver 从 |_ arbiter 仲裁 |_ log mongodb运行日志目录 – 可建立符号链接 指向其他目录 1.3 用户 以 mongodb3 用户名为例(项目中根据实际情况定): # useradd mongodb3 二、操作系统配置 使用 root 用户登录 2.1 如果启用了iptables,将27001端口加入防火墙 # vi /etc/sysconfig/iptables 下面一行内容加在COMMIT之前 ——————————————- -A INPUT -p tcp –dport…

Read More »

mongodb 磁盘空间重用测试对比 (2.6.12 v.s. 3.2.11)

从测试日志可以看出: mongodb3默认的WiredTiger存储引擎,与mongodb2的MMAP相比,在空间利用率上有着质的飞越; mongodb3在删除集合后,对应的磁盘空间会立即回收,这极大的减轻了运维工作量。 以下是测试日志: mongodb_reuse_diskspace_test_log.txt $ mongo –version MongoDB shell version: 2.6.12 ===================================================== 测试集合名称:person2 准备 db.person2.drop(); db.repairDatabase(); $ du -h -d 1 data/master 80M data/master/admin 0B data/master/journal 10G data/master/local 80M data/master/logevents 10G data/master 写入727.2万 727.2万 person2.dataSize=1.6254186630249023G 每条数据 240bytes $ du -h -d 1 data/master 0B data/master/_tmp 80M data/master/admin 289M data/master/journal 10G data/master/local 4.0G data/master/logevents 14G data/master 再写入500万 [2016-12-15 14:08:33.460 CST] main INFO mongodb.MongoDbReuseDiskspaceTest: 1000000条记录已就绪 [2016-12-15 14:09:39.644 CST] main INFO mongodb.MongoDbReuseDiskspaceTest: 写入1000000条记录至Person2成功 [2016-12-15 14:09:40.471 CST] main INFO mongodb.MongoDbReuseDiskspaceTest: 1000000条记录已就绪 [2016-12-15 14:10:48.308…

Read More »

centos 7.2 yum 安装 MySQL 社区版

1、新建yum源 [root@myhost yum.repos.d]# pwd /etc/yum.repos.d [root@myhost yum.repos.d]# cat mysql-community.repo # Enable to use MySQL 5.6 [mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64 enabled=1 gpgcheck=0 2、yum 安装MySQL社区版 [root@myhost yum.repos.d]# yum install mysql-community-server [root@myhost yum.repos.d]# systemctl list-unit-files | grep mysql [root@myhost yum.repos.d]# service mysql start 3、解决告警 [root@myhost yum.repos.d]# cat /var/log/mysqld.log | grep Warning 问题 2016-12-05 15:13:29 9005 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000) 2016-12-05 15:13:29 9005 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000) 解决 [root@myhost ~]# ulimit -a…

Read More »

MongoDB 查询

1.  基本查询: 构造查询数据。 > db.test.findOne() { “_id” : ObjectId(“4fd58ecbb9ac507e96276f1a”), “name” : “stephen”, “age” : 35, “genda” : “male”, “email” : “stephen@hotmail.com” } –多条件查询。下面的示例等同于SQL语句的where name = “stephen” and age = 35 > db.test.find({“name”:”stephen”,”age”:35}) { “_id” : ObjectId(“4fd58ecbb9ac507e96276f1a”), “name” : “stephen”, “age” : 35, “genda” : “male”, “email” : “stephen@hotmail.com” } –返回指定的文档键值对。下面的示例将只是返回name和age键值对。 > db.test.find({}, {“name”:1,”age”:1}) { “_id” : ObjectId(“4fd58ecbb9ac507e96276f1a”), “name” : “stephen”, “age” : 35 }   –指定不返回的文档键值对。下面的示例将返回除name之外的所有键值对。 > db.test.find({}, {“name”:0}) { “_id” : ObjectId(“4fd58ecbb9ac507e96276f1a”), “age” : 35, “genda” : “male”, “email”…

Read More »

MySQL数据去重示例

— ==== 数据清洗 ==== — === 表1:ESB_ERP_BASIC_MODEL_PRICE === — 根据MODL_ST去重 取最新记录 — S1: 设置ROWNUM select @x:= 0; update ESB_ERP_BASIC_MODEL_PRICE t1 set t1.ATTRIBUTE10 = (select @x := @x+1); — S2: 根据ROWNUM去重 DELETE FROM ESB_ERP_BASIC_MODEL_PRICE WHERE ATTRIBUTE10 IN ( select ATTRIBUTE10 from ( select t1.* , if(@g1=t1.MODL_ST, @rank:=@rank+1, @rank:=1) as rank , (@g1:=t1.MODL_ST) as g1 from (select ATTRIBUTE10, MODL_ST, LAST_UPDATE_DATE from ESB_ERP_BASIC_MODEL_PRICE order by modl_st asc, LAST_UPDATE_DATE desc) t1 , (select @g1:=null, @rank:=0) t2 ) t where rank>1 ) ; — ===…

Read More »