From 29d93f635e3cb6bebd6e3896c25b042be88272a9 Mon Sep 17 00:00:00 2001
From: Bunny <1319900154@qq.com>
Date: Sun, 28 Jul 2024 00:12:36 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E7=8B=AC=E5=AE=89?=
=?UTF-8?q?=E8=A3=85=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/init-docs.iml | 9 --
.idea/misc.xml | 6 --
.idea/modules.xml | 8 --
.idea/vcs.xml | 6 --
.idea/workspace.xml | 59 -----------
ReadMe.md | 19 +++-
安装docker内容.md | 242 ++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 256 insertions(+), 93 deletions(-)
delete mode 100644 .idea/init-docs.iml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/vcs.xml
delete mode 100644 .idea/workspace.xml
create mode 100644 安装docker内容.md
diff --git a/.idea/init-docs.iml b/.idea/init-docs.iml
deleted file mode 100644
index d6ebd48..0000000
--- a/.idea/init-docs.iml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 6f29fee..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 897d454..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index cf4aa16..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- "associatedIndex": 8
-}
-
-
-
-
-
- {
- "keyToString": {
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "git-widget-placeholder": "master",
- "kotlin-language-version-configured": "true",
- "nodejs_package_manager_path": "npm",
- "vue.rearranger.settings.migration": "true"
- }
-}
-
-
-
-
-
-
-
-
-
-
-
- 1704285744174
-
-
- 1704285744174
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ReadMe.md b/ReadMe.md
index 83133d2..2d875bc 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -195,7 +195,6 @@ docker ps
```sh
docker pull redis:7.0.10
-mkdir -p /var/lib/docker/volumes/redis-config/_data
```
### 编写配置文件
@@ -214,19 +213,29 @@ appendonly yes #redis持久化 默认是no
tcp-keepalive 300 #防止出现远程主机强迫关闭了一个现有的连接的错误 默认是300
```
+删除注释
+
+```
+daemonize no
+requirepass 123456
+appendonly yes
+tcp-keepalive 300
+```
+
**将文件移出**
```sh
-mkdir /data/redis/ -p
-mv redis.conf /data/redis/redis.conf
+mkdir /bunny/redis/ -p.
+vim /bunny/redis/redis.conf
+mv redis.conf /bunny/redis/redis.conf
```
**启动docker**
```sh
docker run -p 6379:6379 --name redis \
--v /data/redis/redis.conf:/etc/redis/redis.conf \
--v /data/redis/data:/data \
+-v /bunny/redis/redis.conf:/etc/redis/redis.conf \
+-v /bunny/redis/data:/data \
--restart=always \
-d redis:7.0.10 redis-server /etc/redis/redis.conf --appendonly yes
```
diff --git a/安装docker内容.md b/安装docker内容.md
new file mode 100644
index 0000000..eb6de92
--- /dev/null
+++ b/安装docker内容.md
@@ -0,0 +1,242 @@
+# 安装docker内容
+
+```shell
+# 安装必要依赖
+yum install -y yum-utils device-mapper-persistent-data lvm2
+
+# 设置镜像源
+sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
+yum list docker-ce --showduplicates | sort -r
+
+# 安装docker
+yum -y install docker-ce.x86_64
+
+# 开机启动docker
+systemctl enable docker
+systemctl start docker
+```
+
+## 安装Redis
+
+### 编写配置文件
+
+```sh
+mkdir /bunny/redis/ -p
+vim /bunny/redis/redis.conf
+```
+
+**添加以下内容**
+
+```
+# bind 127.0.0.1 #注释掉这部分,使redis可以外部访问
+daemonize no #用守护线程的方式启动
+requirepass 123456
+appendonly yes #redis持久化 默认是no
+tcp-keepalive 300 #防止出现远程主机强迫关闭了一个现有的连接的错误 默认是300
+```
+
+**删除注释**
+
+```
+daemonize no
+requirepass 123456
+appendonly yes
+tcp-keepalive 300
+```
+
+### 启动docker
+
+```sh
+docker pull redis:7.0.10
+docker run -p 6379:6379 --name redis_master \
+-v /bunny/docker/redis/master/redis.conf:/etc/redis/redis.conf \
+-v /bunny/docker/redis/master/data:/data \
+--restart=always \
+-d redis:7.0.10 redis-server /etc/redis/redis.conf --appendonly yes
+```
+
+## 安装MySQL
+
+**设置开机启动**
+
+**执行启动3306:**
+
+```sh
+docker run --name mysql_master -p 3306:3306 \
+-v /bunny/docker/mysql/master/conf:/etc/mysql/conf.d \
+-v /bunny/docker/mysql/master/data:/var/lib/mysql \
+--restart=always --privileged=true \
+-e MYSQL_ROOT_PASSWORD=02120212 mysql:8.0.33
+```
+
+**执行启动3305:**
+
+```shell
+docker run --name mysql_slave1 -p 3305:3306 \
+-v /bunny/docker/mysql/slave1/conf:/etc/mysql/conf.d \
+-v /bunny/docker/mysql/slave1/data:/var/lib/mysql \
+--restart=always --privileged=true \
+-e MYSQL_ROOT_PASSWORD=02120212 mysql:8.0.33
+```
+
+**修改密码:**
+
+```sh
+docker exec -it mysql_master /bin/bash
+mysql -uroot -p02120212
+use mysql
+ALTER USER 'root'@'%' IDENTIFIED BY "02120212";
+FLUSH PRIVILEGES;
+```
+
+## 安装Minio
+
+```sh
+docker run -d \
+ -p 9000:9000 \
+ -p 9090:9090 \
+ --name minio \
+ -v /bunny/docker/minio/data:/data \
+ -e "MINIO_ROOT_USER=bunny" \
+ -e "MINIO_ROOT_PASSWORD=02120212" \
+ minio/minio server /data --console-address ":9090"
+```
+
+## 安装Nacos
+
+```sh
+docker run --name nacos -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:v2.1.0
+```
+
+## 安装rabbitmq
+
+```sh
+docker run \
+ -e RABBITMQ_DEFAULT_USER=bunny \
+ -e RABBITMQ_DEFAULT_PASS=02120212 \
+ -v /bunny/docker/rabbitmq/plugin:/plugins \
+ --name rabbitmq \
+ --hostname rabbitmq \
+ -p 15672:15672 \
+ -p 5672:5672 \
+ --network rabbitmq \
+ -d rabbitmq:3.8-management
+```
+
+### 进入容器
+
+```sh
+docker exec -it rabbitmq bash
+rabbitmq-plugins enable rabbitmq_management
+```
+
+### 无法登录
+
+```sh
+#进入容器
+docker exec -it 你的容器名或者id /bash
+
+# 添加用户
+rabbitmqctl add_user 用户名 密码
+
+# 如果存在可以先删除
+rabbitmqctl delete_user 用户名
+
+#设置用户操作权限
+rabbitmqctl set_user_tags 用户名 administrator
+```
+
+#### 添加
+
+```sh
+#进入容器
+docker exec -it 你的容器名或者id /bin/bash
+
+# 添加用户
+rabbitmqctl add_user admin 123456
+#设置用户操作权限
+rabbitmqctl set_user_tags admin administrator
+```
+
+## 安装elasticsearch
+
+### 创建网络
+
+```sh
+docker network create es-net
+```
+
+### 加载镜像
+
+```sh
+# 导入数据
+docker load -i es.tar
+```
+
+### 部署
+
+```sh
+docker run -d \
+ --name elasticsearch \
+ -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
+ -e "discovery.type=single-node" \
+ -v /bunny/docker/es/data:/usr/share/elasticsearch/data \
+ -v /bunny/docker/es/plugins:/usr/share/elasticsearch/plugins \
+ --privileged \
+ --network es-net \
+ -p 9200:9200 \
+ -p 9300:9300 \
+ --restart=always elasticsearch:7.12.1
+```
+
+> 验证:http://192.168.3.98:9200/
+
+## Harbor安装
+
+### 下载Harbor
+
+github下载地址:https://github.com/goharbor/harbor/releases
+
+```shell
+# 解压tgz包
+tar -zxvf harbor-offline-installer-v2.10.1.tgz
+# 进入目录后进行复制配置文件
+cd harbor/
+# 创建一个配置文件
+cp harbor.yml.tmpl harbor.yml
+# 修改配置文件
+vim harbor.yml
+```
+
+
+
+
+
+在我的当前版本中默认密码修改后无法访问,需要查看数据库密码
+
+```bash
+# 进入容器
+docker exec -it harbor-core bash
+# 查看密码
+printenv | grep PASSWORD
+```
+
+
+
+### 安装Harbor
+
+```shell
+sh install.sh
+```
+
+启动相关命令
+这个启动方式需要在你的目录/harbor/下执行,我的当前目录是/root/harbor/所以需要在这个目录下启动,否则会报找不到指定文件等错误。
+
+```shell
+# 关闭 Harbor
+docker compose -f docker-compose.yml stop
+
+# 启动 Harbor
+docker compose -f docker-compose.yml up -d
+```
+