当前位置:网站首页>大型电商项目-环境搭建
大型电商项目-环境搭建
2022-07-03 09:30:00 【小破程序员】
1.使用docker安装mysq5.7和 redis
docker pull mysql:5.7
执行下面的指令,然后mysql就装好了
docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7 使用docker -ps 查看正在运行的容器

如下图说明mysql已经安装好并创建了一个容器正在运行
指令说明:
docker run -p 3306:3306 --name mysql 创建并启动mysql容器
ip 前面一个3306是docker的端口,后面的3306是容器内部mysql的端口
--name 就是给运行的容器起一个名字
-v /mydata/mysql/log:/var/log/mysql \ /mydata/mysql/log是linux本机的目录,后面/var/log/mysql \ 是mysql容器里面的目录,这里的意思是,将容器里的目录挂载到本机,当容器内对应目录中的文件发生改变的时候,本地的linux对应目录中的内容也会发生改变,这样做是为了简化操作,不用每次要看文件的时候都要先进入到容器中。在外部修改以后,容器内部也会跟着变化。
其实,每个容器都是一个完整的linux运行环境,拿mysql俩说,mysql容器包含linux的kernel(内核)和mysql软件
配置mysql, 在/mydata/mysql/conf 目录下新建my.cnf文件,加入如下配置
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection=utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
安装redis
docker pull redis
然后配置redis,执行下面的命令,创建redis容器并在mydata下面映射redis的配置文件
docker run -p 6379:6379 --name redis \
-v /mydata/redis/data:/data \
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis redis-server /etc/redis/redis.conf测试redis,启动redis客户端
docker exec -it redis redis-cli

这时候的redis数据只能保存在内存中,并不能持久话,配置redis的持久化,开启aof持久化。在redis.conf 配置文件中增加配置
appendonly yes
边栏推荐
- Inverse code of string (Jilin University postgraduate entrance examination question)
- GAOFAN Weibo app
- Ut2012 learning notes
- Classification (data consolidation and grouping aggregation)
- Ind yff first week
- Several problems encountered in installing MySQL under MAC system
- Matrix calculation of Neural Network Introduction (pytoch)
- Leetcode刷题---10
- Judging the connectivity of undirected graphs by the method of similar Union and set search
- mysql5.7安装和配置教程(图文超详细版)
猜你喜欢

Mysql5.7 installation and configuration tutorial (Graphic ultra detailed version)

High imitation bosom friend manke comic app

I really want to be a girl. The first step of programming is to wear women's clothes

A complete mall system

Ut2014 supplementary learning notes

【SQL】一篇带你掌握SQL数据库的查询与修改相关操作

Entropy method to calculate weight

2018 Lenovo y7000 black apple external display scheme

深度学习入门之线性回归(PyTorch)

Install yolov3 (Anaconda)
随机推荐
Leetcode刷题---1
Model evaluation and selection
【吐槽&脑洞】关于逛B站时偶然体验的弹幕互动游戏魏蜀吴三国争霸游戏的一些思考
Leetcode skimming ---217
Powshell's set location: unable to find a solution to the problem of accepting actual parameters
extern关键字
[combinatorial mathematics] pigeon's nest principle (simple form of pigeon's nest principle | simple form examples of pigeon's nest principle 1, 2, 3)
Leetcode skimming ---263
熵值法求权重
Jetson TX2 刷机
A detailed explanation of vector derivative and matrix derivative
A super cool background permission management system
神经网络入门之预备知识(PyTorch)
Handwritten digit recognition: CNN alexnet
Ind FHL first week
Hands on deep learning pytorch version exercise solution - 2.4 calculus
An open source OA office automation system
Leetcode刷题---75
Hands on deep learning pytorch version exercise solution-3.3 simple implementation of linear regression
MySQL reports an error "expression 1 of select list is not in group by claim and contains nonaggre" solution