首页
About Me
推荐
weibo
github
Search
1
linuxea:gitlab-ci之docker镜像质量品质报告
49,451 阅读
2
linuxea:如何复现查看docker run参数命令
23,044 阅读
3
Graylog收集文件日志实例
18,580 阅读
4
linuxea:jenkins+pipeline+gitlab+ansible快速安装配置(1)
18,275 阅读
5
git+jenkins发布和回滚示例
18,181 阅读
ops
Openvpn
Sys Basics
rsync
Mail
NFS
Other
Network
HeartBeat
server 08
Code
Awk
Shell
Python
Golang
virtualization
KVM
Docker
openstack
Xen
kubernetes
kubernetes-cni
Service Mesh
Data
Mariadb
PostgreSQL
MongoDB
Redis
MQ
Ceph
TimescaleDB
kafka
surveillance system
zabbix
ELK Stack/logs
Open-Falcon
Prometheus
victoriaMetrics
Web
apache
Tomcat
Nginx
自动化
Puppet
Ansible
saltstack
Proxy
HAproxy
Lvs
varnish
更多
互联咨询
最后的净土
软件交付
持续集成
gitops
devops
登录
Search
标签搜索
kubernetes
docker
zabbix
Golang
mariadb
持续集成工具
白话容器
elk
linux基础
nginx
dockerfile
Gitlab-ci/cd
最后的净土
基础命令
gitops
jenkins
docker-compose
Istio
haproxy
saltstack
marksugar
累计撰写
690
篇文章
累计收到
139
条评论
首页
栏目
ops
Openvpn
Sys Basics
rsync
Mail
NFS
Other
Network
HeartBeat
server 08
Code
Awk
Shell
Python
Golang
virtualization
KVM
Docker
openstack
Xen
kubernetes
kubernetes-cni
Service Mesh
Data
Mariadb
PostgreSQL
MongoDB
Redis
MQ
Ceph
TimescaleDB
kafka
surveillance system
zabbix
ELK Stack/logs
Open-Falcon
Prometheus
victoriaMetrics
Web
apache
Tomcat
Nginx
自动化
Puppet
Ansible
saltstack
Proxy
HAproxy
Lvs
varnish
更多
互联咨询
最后的净土
软件交付
持续集成
gitops
devops
页面
About Me
推荐
weibo
github
搜索到
8
篇与
的结果
2016-02-25
Redis编译安装和saltstack简单配置(1)
分布式存储之-Redisredis常用于数据库读缓存和写缓存,通常写缓存需要考虑到数据一致性的问题,读缓存应用较多redis是一个开源的,使用c语言编写的,支持网络交互的,可基于内存也可持久化的key-value数据库目前国内最大的redis集群--新浪微博redis和memcached对比[root@yum-down local]# wget http://download.redis.io/releases/redis-3.0.7.tar.gz [root@yum-down local]# tar xf redis-3.0.7.tar.gz [root@yum-down local]# cd redis-3.0.7 [root@yum-down redis-3.0.7]# make PREFIX=/usr/local/redis install [root@yum-down utils]# cp redis_init_script /etc/init.d/redis [root@yum-down utils]# chmod +x /etc/init.d/redis 修改脚本中的安装路径[root@yum-down utils]# vim /etc/init.d/redis EXEC=/usr/local/redis/bin/redis-server CLIEXEC=/usr/local/redis/bin/redis-cli 创建配置文件路径,并复制配置文件以端口号命名[root@yum-down redis-3.0.7]# mkdir /etc/redis [root@yum-down redis-3.0.7]# cp /usr/local/redis-3.0.7/redis.conf /etc/redis/6379.conf 第一次启动,如果没有修改是启动在前台页面[root@yum-down ~]# /etc/init.d/redis start Starting Redis server... 5228:M 24 Feb 07:16:27.342 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.0.7 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 5228 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 5228:M 24 Feb 07:16:27.344 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 5228:M 24 Feb 07:16:27.344 # Server started, Redis version 3.0.7 5228:M 24 Feb 07:16:27.344 # 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. 5228:M 24 Feb 07:16:27.344 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 5228:M 24 Feb 07:16:27.344 * The server is now ready to accept connections on port 6379 ^C5228:signal-handler (1456327043) Received SIGINT scheduling shutdown... 5228:M 24 Feb 07:17:23.607 # User requested shutdown... 5228:M 24 Feb 07:17:23.607 * Saving the final RDB snapshot before exiting. 5228:M 24 Feb 07:17:23.611 * DB saved on disk 5228:M 24 Feb 07:17:23.611 # Redis is now ready to exit, bye bye...修改配置文件‘daemonize 改为yes’[root@yum-down ~]# vim /etc/redis/6379.conf daemonize yes 修改pid和/etc/init.d/redis中的pid一致pidfile /var/run/redis_6379.pid [root@yum-down ~]# /etc/init.d/redis start Starting Redis server... [root@yum-down ~]# netstat -ntlp |grep redis tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 5235/redis-server tcp 0 0 :::6379 :::* LISTEN 5235/redis-server 关闭测试[root@yum-down ~]# service redis stop Stopping ... Redis stopped [root@yum-down ~]# 做一个软连接启动:[root@yum-down ~]# ln -s /usr/local/redis/bin/redis-cli /usr/local/bin/redis-cli [root@yum-down ~]# redis-cli 127.0.0.1:6379> 由于redis是单线程,只能使用一个cpu,可以启动多个,则可以指定ip和端口[root@yum-down ~]# redis-cli -h 10.10.0.250 -p 6379 10.10.0.250:6379> 简单的使用:set插入字符串,get查看[root@yum-down ~]# redis-cli -h 10.10.0.250 -p 6379 10.10.0.250:6379> set keyname hello OK 10.10.0.250:6379> get keyname "hello" 10.10.0.250:6379> 过滤:显示所有10.10.0.250:6379> keys * 1) "keya" 2) "keyna" 3) "keyname1" 4) "keyname" 匹配keyname开头10.10.0.250:6379> keys keyname? 1) "keyname2" 2) "keyname1" 10.10.0.250:6379> 判断key是否存在,0不存在,非0则存在,表示数量10.10.0.250:6379> EXISTS keya (integer) 1 10.10.0.250:6379> EXISTS keya1 (integer) 0 10.10.0.250:6379> 删除:0不存在,非0则存在,表示数量10.10.0.250:6379> DEL keya (integer) 1 10.10.0.250:6379> DEL keya (integer) 0 10.10.0.250:6379> info:# Keyspace db0:keys=2,expires=0,avg_ttl=0 db0:实例如下:SELECT 1和2两个实例,分别插入数据10.10.0.250:6379[2]> SELECT 1 OK 10.10.0.250:6379[1]> SELECT 2 OK 10.10.0.250:6379[2]> SET 1 1 OK 10.10.0.250:6379[2]> SELECT 1 OK 10.10.0.250:6379[1]> SET 1 1 OK 在使用info查看就有了1和2的实例# Keyspace db0:keys=2,expires=0,avg_ttl=0 db1:keys=1,expires=0,avg_ttl=0 db2:keys=1,expires=0,avg_ttl=0 flushall可清空所有实例10.10.0.250:6379[1]> flushall keys:key数量expires:过期数量avg_ttl:ttl数量简单的配置文件说明:[root@yum-down ~]# egrep -v "^#|^$" /etc/redis/6379.conf daemonize yes 前后台启动 pidfile /var/run/redis.pid pid位置 port 6379 端口 logfile "" 日志 dir ./ 启动的目录 [root@yum-down ~]# redis-saltstack配置1,复制安装包到salt/redis/files/2,复制配置文件到salt/redis/files/3, 复制启动脚本到salt/redis/files/目录下,没有则创建;top中指定即可install.sls如下: file.managed: - name: /usr/local/src/redis-3.0.7.tar.gz - source: salt://redis/files/redis-3.0.7.tar.gz - user: root - group: root - mode: 755 cmd.run: - name: cd /usr/local/src && tar xf redis-3.0.7.tar.gz && cd redis-3.0.7 && PREFIX=/usr/local/redis install - unless: test -d /usr/local/redis redis-config: file.managed: - name: /etc/redis/6379.conf - spurce: salt://redis/files/6379.conf - user: root - group: root - mode: 644 redis-service: file.managed: - name: /etc/init.d/redis - source: salt://redis/files/redis.init - user: root - group: root - mode: 755 cmd.run - name: chkconfig --add redis && chkconfig redis on - unless: chkconfig --list |grep redis service.runnig: - name: redis - emable: True - watch: - file: redis-config - require: - cmd: redis-install - cmd: redis-service
2016年02月25日
3,284 阅读
0 评论
0 点赞
1
2