- 一、Java 软件安装集
- 二、分布式文件系统安装集
- 三、SQL 数据库安装集
- 四、NoSQL 数据库安装集
Redis
一、Redis—Windows
- 下载 dmajkic/redis
- 安装启动及设置密码
redis-server.exe
redis-cli.exe
redis-check-aof.exe
redis-benchmark.exe
二、Redis—Linux
1. 下载
wget https://download.redis.io/releases/redis-4.0.2.tar.gz
2. 安装
tar xzf redis-4.0.2.tar.gz
cd redis-4.0.2
make
3. 启动
cd src./redis-server
./redis-server ../redis.conf
daemonize yes
/etc/init.d/redis-server start
/etc/init.d/redis-server stop
/etc/init.d/redis-server restart
三、Redis—CentOS—YUM
1. C++ 环境安装
yum install gcc-c++
gcc -v
make
make install
- Redis 默认安装路径:
/usr/local/bin
/usr/local/bin/redis-server /usr/local/bin/redis.conf
ps -ef | grep redis
四、Redis—Ubuntu
- Ubuntu 安装 Redis
- Ubuntu 安装 Redis
五、Redis—Docker
- Docker 安装 Redis
- docker安装redis,挂载外部配置和数据
1. 前置准备
mkdir -p /root/redis/conf /root/redis/data
chmod -R 755 /root/redis/
wget -P /root/redis/conf http://download.redis.io/redis-stable/redis.conf
vi /root/redis/conf/redis.conf
2. 创建并启动容器
docker pull redis
docker run -d --name ['redis_1'] -p 6379:6379 \-v '/root/redis/conf/redis.conf:/etc/redis/redis.conf' \-v '/root/redis/data:/data' \['镜像ID'] \redis-server /etc/redis/redis.conf \--appendonly yes \--requirepass '123456'
docker update --restart=always ['容器ID']
参数 |
说明 |
-d |
指定容器后台运行 |
–name redis_1 |
设置容器名称为 redis_1 |
-p 6379:6379 |
将宿主机 6379端口 映射到容器内 6379端口 |
-v /root/redis/redis.conf:/etc/redis/redis.conf |
将宿主机 redis.conf文件 映射到容器内 redis.conf文件 |
-v /root/redis/data:/data |
将宿主机 /usr/local/redis/data目录 映射到容器内 /data目录 (方便备份持久化数据) |
镜像ID |
|
redis-server /etc/redis/redis.conf |
以容器内的 redis.conf配置 启动 Redis |
–appendonly yes |
指定为 AOF持久化(默认是 RDB持久化,也可在 redis.conf文件 中配置) |
–requirepass 123456 |
Redis 连接密码 |
六、Redis—Dockerfile
- docker 创建redis容器以及redis命令笔记
七、Redis—操作
1. 连接退出
- 在 Windows 本地
redis-cli.exe
所在目录的命令行。
redis-cli -h 127.0.0.1
127.0.0.1:6379> ping
PONG
set name qs
get name
keys *
shutdown
quit/exit
2. 连接工具—RedisDesktopManager
3. 性能测试—redis-benchmark
redis-benchmark
:官方自带的一个压力测试工具。
redis-benchmark -h localhost -p 6379 -c 100 -n 100000
八、Redis—配置
spring: redis:host: 192.168.0.1port: 6379password: 123456database: 0
spring.redis.host=localhost
spring.redis.port=6379
spring.redis.password=123456
spring.redis.jedis.pool.max-active=100
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.max-wait=100000
spring.redis.jedis.pool.min-idle=0
spring.redis.timeout=10000
spring: redis:cluster:nodes: 192.168.0.1:6379,192.168.0.2:6379password: 123456database: 0
spring.redis.cluster.nodes=127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381,127.0.0.1:6382,127.0.0.1:6383,127.0.0.1:6384
spring.redis.timeout=60000
spring.redis.database=0
spring.redis.jedis.pool.max-active=100
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.max-wait=100000
spring.redis.jedis.pool.min-idle=0
spring.redis.timeout=10000
MongoDB
一、MongoDB—Docker
- mongo
- NoSQL Manager for MongoDB:
L1、L2
1. 创建容器
docker search 'mongo'
docker pull 'mongo'docker run -d --name='mongo_1' -p 27017:27017 \-v /root/mongo/configdb:/data/configdb/ \-v /root/mongo/db/:/data/db/ \['镜像ID'] --auth
2. 登录容器
docker exec -it '容器ID' mongo admin
> use admin
> db.createUser({
user: 'admin', pwd: '123456', roles: [ {
role: "userAdminAnyDatabase", db: "admin" } ] });
exit
docker exec -it '容器ID' mongo admin
db.auth("admin","123456");
db.createUser({
user: 'qs', pwd: '123456', roles: [ {
role: "readWrite", db: "app" } ] });
exit
docker exec -it '容器ID' mongo admin
db.auth("qs","123456");
use app
db.test.save({
name:"qs"});
二、MongoDB—操作