redis部署(redis部署在哪台服务器)
本篇文章给大家谈谈redis部署,以及redis部署在哪台服务器对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
docker部署redis集群(实战)
集群的话我们要建立自己的网卡。
创建多个节缺袭点(实例是6个三个主三个从):
for port in $(seq 1 6); \
do \
mkdir -p /mydata/redis/node-${port}/conf
touch /mydata/redis/node-${port}/conf/redis.conf
cat EOF /mydata/redis/node-${port}/conf/redis.conf
port 6379
bind 0.0.0.0
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
cluster-announce-ip 172.38.0.1${port}
cluster-announce-port 6379
cluster-announce-bus-port 16379
appendonly yes
EOF
done
for port in $(seq 1 6); \
do \
docker run -p 637${port}:6379 -p 1637${port}:16379 --name redis-${port} \
-v /mydata/redis/伏消兄node-${port}/data:/data \
-v /mydata/redis/node-${port}/conf/桥肆redis.conf:/etc/redis/redis.conf \
-d --net redis-net --ip 172.38.0.1${port} redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf;
done
先进入:
docker exec -it redis-1 /bin/sh
集群:
redis-cli --cluster create 172.38.0.11:6379 172.38.0.12:6379 172.38.0.13:6379 172.38.0.14:6379 172.38.0.15:6379 172.38.0.16:6379 --cluster-replicas 1
[img]docker nginx、rabbitmq、redis部署
1.在服务器下首先安装docker
2.docker nginx部署:
[root@cs007 hs]# docker pull nginx
[root@cs007 hs]# docker run --name nginx-test -p 8081:80 -d nginx
[root@cs007 hs]# docker ps -a -n 1
[root@cs007 hs]# curl localhost:8081
外网访问:服务器地址:8081/nginx
docker 部署mysql
docker pull registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
docker run -itd --name mysql-0331 -p 3306:3306 -v /opt/mysql/data:/var/lib/mysql -eMYSQL_ROOT_PASSWORD=sq registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
docker
ps或 docker ps-a或 docker ps-a--no-trunc
docker inspect mysql
1.mkdir -p /opt/mysql/升弯data
docker pull registry.cn-hangzhou.aliyuncs.com/纤笑孙sqqdcl/db:v5
docker run -itd --name mysql-0331 -p 3307:3306 -v /opt/mysql/毁链data:/var/lib/mysql -eMYSQL_ROOT_PASSWORD=sq registry.cn-hangzhou.aliyuncs.com/sqqdcl/db:v5
docker ps或 docker ps-a或 docker ps-a--no-trunc
docker inspect mysql
PS C:\Users\Administrator docker exec -it e988fbe43744 /bin/bash
root@e988fbe43744:/docker-entrypoint-initdb.d# mysql -psq
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql exit
2.rabbitmq部署
mkdir -p /opt/rabbitmq/data
docker pull rabbitmq:3.8.3-management
docker run -itd--name rabbitmq0401 -p5672:5672 -p15672:15672 -p15692:15692 -v /opt/rabbitmq/data:/var/lib/rabbitmq -eRABBITMQ_DEFAULT_USER=guest -eRABBITMQ_DEFAULT_PASS=guest rabbitmq:3.8.3-management
3.redis部署
mkdir -p /opt/redis/data
docker pull registry.cn-hangzhou.aliyuncs.com/sqqdcl/redis
docker run -itd --name redis-0401 -p 6380:6379 -v /opt/redis/data:/data -v /etc/localtime:/etc/localtime:ro registry.cn-hangzhou.aliyuncs.com/sqqdcl/redis
docker run -itd --name redis-0401 -p 6380:6379 -v /opt/redis/data:/data registry.cn-hangzhou.aliyuncs.com/sqqdcl/redis
redis-2.8.21怎么部署
Redis集群部署文档(centos6系统)
(要让集群正常工作至少需要3个主节点,在这里我们要创建6个redis节点,其中三个为主节点,三个为从节点,对应的redis节点的ip和端口对应关系如下)
a class="baidu-highlight" href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvuhfsmHu9nW6kmHczPj0s0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPWf3rHnLrjRYPWc3rHb1nHcd" target="_blank"127.0.0.1/a:7000
a class="baidu-highlight" href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvuhfsmHu9nW6kmHczPj0s0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPWf3rHnLrjRYPWc3rHb1nHcd" target="_blank"127.0.0.1/a:7001
a class="baidu-highlight" href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvuhfsmHu9nW6kmHczPj0s0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPWf3rHnLrjRYPWc3rHb1nHcd" target="_blank"127.0.0.1/a:7002
127.0.0.1:7003
127.0.0.1:7004
127.0.0.1:7005
1:下载redis。官网下载3.0.0版本,之前2.几的版本不支持集群模式
下载地址:a href="https:// github.com/antirez/redis/archive/3.0.0-rc2.tar.gz" target="_blank"https:// github.com/antirez/redis/archive/3.0.0-rc2.tar.gz/a
2:行举上传服务器,解压,编译
tar -zxvf redis-3.0.0-rc2.tar.gz mv redis-3.0.0-rc2.tar.gz redis3.0cd /usr/local/redis3.0makemake install
3:创建集群需要的目录
mkdir -p /usr.local/clustercd /usr.local/clustermkdir 7000mkdir 7001mkdir 7002mkdir 7003mkdir 7004mkdir 7005
4:修改配置文件redis.conf
cp /usr/local/redis3.0/redis.conf /usr.local/clustervi redis.conf##修改配置文件中的贺洞下面选项port 7000daemonize yescluster-enabled yescluster-config-file nodes.confcluster-node-timeout 5000appendonly yes##修改完redis.conf配置文件中档拍碧的这些配置项之后把这个配置文件分别拷贝到7000/7001/7002/7003/7004/7005目录下面cp /usr/local/cluster/redis.conf /usr/local/cluster/7000cp /usr/local/cluster/redis.conf /usr/local/cluster/7001cp /usr/local/cluster/redis.conf /usr/local/cluster/7002cp /usr/local/cluster/redis.conf /usr/local/cluster/7003cp /usr/local/cluster/redis.conf /usr/local/cluster/7004cp /usr/local/cluster/redis.conf /usr/local/cluster/7005 ##注意:拷贝完成之后要修改7001/7002/7003/7004/7005目录下面redis.conf文件中的port参数,分别改为对应的文件夹的名称
5:分别启动这6个redis实例
cd /usr/local/cluster/7000redis-server redis.confcd /usr/local/cluster/7001redis-server redis.confcd /usr/local/cluster/7002redis-server redis.confcd /usr/local/cluster/7003redis-server redis.confcd /usr/local/cluster/7004redis-server redis.confcd /usr/local/cluster/7005redis-server redis.conf ##启动之后使用命令查看redis的启动情况ps -ef|grep redis如下图显示则说明启动成功
6:执行redis的创建集群命令创建集群
cd /usr/local/redis3.0/src./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
6.1执行上面的命令的时候会报错,因为是执行的ruby的脚本,需要ruby的环境
错误内容:/usr/bin/env: ruby: No such file or directory
所以需要安装ruby的环境,这里推荐使用yum install ruby安装
yum install ruby
6.2然后再执行第6步的创建集群命令,还会报错,提示缺少rubygems组件,使用yum安装
错误内容:
./redis-trib.rb:24:in `require': no such file to load -- rubygems (LoadError)
from ./redis-trib.rb:24
yum install rubygems
6.3再次执行第6步的命令,还会报错,提示不能加载redis,是因为缺少redis和ruby的接口,使用gem 安装
错误内容:
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- redis (LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./redis-trib.rb:25
gem install redis
6.4 再次执行第6步的命令,正常执行
输入yes,然后配置完成。
至此redis集群即搭建成功!
7:使用redis-cli命令进入集群环境
redis-cli -c -p 7000
关于redis部署和redis部署在哪台服务器的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。