Browse Source

更新笔记

master
许孟阳 3 years ago
parent
commit
35ad18004c
  1. 18
      4.shell/3.看门狗脚本.md
  2. 114
      4.shell/5.docker.md
  3. 23
      5.linux环境/5.gitlab.md
  4. 159
      5.linux环境/9.frp.md
  5. 5
      Markdown使用.md

18
4.shell/3.看门狗脚本.md

@ -47,7 +47,6 @@ @@ -47,7 +47,6 @@
```shell
#!/bin/sh
#!/bin/sh
while [ 1 ]
do
@ -77,9 +76,9 @@ @@ -77,9 +76,9 @@
```
- 配置文件
```txt
@ -88,4 +87,15 @@ @@ -88,4 +87,15 @@
/home/work/mengyxu/location/location.jar -Xms32m -Xmx64m
```
## 开机启动看门狗脚本
```shell
vim /etc/profile
```
在文件末尾添加
```tex
nohup /home/work/mengyxu/watchdog/jarWatch.sh > /dev/null 2>&1 &
```

114
4.shell/5.docker.md

@ -0,0 +1,114 @@ @@ -0,0 +1,114 @@
# 常用命令
## 查看版本
```shell
docker version
```
## 从Docker文件构建镜像
```shell
docker build -t image-name docker-file-location
```
*-t*:它用于指定使用提供的名称来标记Docker映像。
## 运行镜像/创建容器
```shell
docker run -d image-name
```
*-d*:用于创建守护程序进程
## 查看可用的镜像
```shell
docker images
```
## 查看运行容器
```shell
docker ps -l //显示最新的可用容器
docker ps -a //显示所有可用的容器
```
## 运行与停止容器
```shell
docker start container_id
docker stop container_id
docker restart container_id
```
## 进入容器
```shell
docker exec -it container-id bash
```
## 删除容器
```shell
docker rm -f container_id //删除指定容器
docker rm $(docker ps -a -q) //删除所有容器
```
## 删除镜像
```shell
docker rmi image-name //删除指定镜像
docker rmi $(docker images -q) //删除所有镜像
docker rmi -r $(docker images -q) //强制删除所有镜像
```
## 修改容器端口映射
- 停止容器
- 查找容器ID
```shell
docker inspect nginx-alpine
```
容器ID为:004d95fb40fd811128a5fb6c6c6ae8fab51e234779f92e5a91d0d84e0a80cb1c
- 进入容器目录
```
cd cd /home/docker/containers/004d95fb40fd811128a5fb6c6c6ae8fab51e234779f92e5a91d0d84e0a80cb1c
```
- 修改容器配置
```shell
vim hostconfig.json
```
其中`PortBindings`属性即为容器端口映射配置
- 修改后重启容器
# 其他
## docker container update
更新一个或多个容器的配置
```shell
docker container update [OPTIONS] CONTAINER [CONTAINER...]
```
| 名称,简写 | 默认值 | 描述 |
| -------------------- | ------ | ------------------------------------------------------------ |
| --blkio-weight | 0 | 阻塞IO(相对权重),介于`10`和`1000`之间,或`0`禁用(默认为`0`) |
| --cpu-period | 0 | 限制CPU CFS(完全公平的调度程序)周期 |
| --restart | | 重新启动在容器退出时应用的策略 |
| --memory, -m | | 内存限制 |
| --kernel-memory | | 内核内存限制 |
| --memory-swap | | 交换限制等于内存加交换:’`-1`‘以启用无限制的交换 |
| --memory-reservation | | 内存软限制 |

23
5.linux环境/5.gitlab.md

@ -42,36 +42,35 @@ @@ -42,36 +42,35 @@
* 清理命令
```shell
wget https://gitlab.com/xhang/gitlab/repository/12-0-stable-zh/archive.tar.bz2 -O gitlab-12-0-stable-zh.tar.bz2
\cp -rf gitlab-v12.0.0/* /opt/gitlab/embedded/service/gitlab-rails/
```
* 停止gitlab
```shell
gitlab-ctl stop
```
* 卸载gitlab
```shell
rpm -e gitlab-ce
```
- 查看进程
```shell
ps aux | grep gitlab
```
- 杀掉守护进程
```shell
kill -9 xxx
```
- 清理残余文件
```shell
find / -name gitlab | xargs rm -rf
```

159
5.linux环境/9.frp.md

@ -0,0 +1,159 @@ @@ -0,0 +1,159 @@
# 服务端
## 官网Releases版本安装
- 下载最新的[release版本](https://github.com/fatedier/frp/releases)
```shell
wget https://github.com/fatedier/frp/releases/download/v0.38.0/frp_0.38.0_linux_amd64.tar.gz
```
- 解压并命重命名
```shell
tar -zxvf frp_0.38.0_darwin_amd64.tar.gz
mv frp_0.38.0_darwin_amd64 frp
cd frp
```
- 修改服务端配置
```shell
vim frps.ini
```
将以下配置写入文件
```tex
[common]
bind_port = 7000
# 启用面板
dashboard_port = 7001
# 面板登录名和密码
dashboard_user = mengyxu
dashboard_pwd = iaminlove.20.
# 使用http代理并使用7002端口进行穿透
vhost_http_port = 7002
# 使用https代理并使用7003端口进行穿透
vhost_https_port = 7003
```
- 启动frp服务端
```shell
./frps -c ./frps.ini
```
## 使用docker安装
- 拉取镜像
```shell
docker pull snowdreamtech/frps
```
- 添加配置文件
```shell
mkdir /home/frp
cd /home/frp
vim frps.ini
```
配置内容与上面一样
- 建立容器
```shell
docker run --name frps --restart=always -d \
-p 7000:7000 \
-p 7001:7001 \
-p 7002:7002 \
-p 7003:7003 \
-p 7004:7004 \
-p 7005:7005 \
-v /home/frp/frps.ini:/etc/frp/frps.ini \
snowdreamtech/frps
```
*注意挂载目录与端口映射*
# 客户端
## 官网Releases版本安装
- 下载最新的[release版本](https://github.com/fatedier/frp/releases)
```shell
wget https://github.com/fatedier/frp/releases/download/v0.38.0/frp_0.38.0_linux_amd64.tar.gz
```
- 解压并命重命名
```shell
tar -zxvf frp_0.38.0_darwin_amd64.tar.gz
mv frp_0.38.0_darwin_amd64 frp
cd frp
```
- 修改客户端配置文件
```shell
vim frpc.ini
```
```tex
[common]
server_addr = 114.132.229.108
server_port = 7000
[11-ssh]
type = tcp
local_ip = 10.100.0.221
local_port = 1122
remote_port = 7004
[11-mysql]
type = tcp
local_ip = 10.100.0.221
local_port = 11306
remote_port = 7005
[11-masterlab]
type = tcp
local_ip = 10.100.0.221
local_port = 1181
remote_port = 7006
```
[frp客户端的详细配置说明](https://gofrp.org/docs/reference/client-configures/)
- 启动`frp`客户端
```shell
./frpc -c ./frpc.ini
nohup ./frpc -c ./frpc.ini >./frpc.log 2>&1 &
```
## 使用docker安装
- 拉取镜像
```shell
docker pull snowdreamtech/frpc
```
- 创建配置文件
```shell
mkdir /home/frp
cd /home/frp
vim frpc.ini
```
配置比较麻烦,不建议用docker装
- 创建容器

5
Markdown使用.md

@ -235,3 +235,8 @@ fun (x: Int, y: Int): Int { @@ -235,3 +235,8 @@ fun (x: Int, y: Int): Int {
\- 减号
\. 英文句点
\! 惊叹号
# Markdown编辑器
推荐使用**Typora**

Loading…
Cancel
Save