backup
This commit is contained in:
parent
fc99a64d28
commit
43b2129767
|
@ -15,8 +15,6 @@ mount /dev/sda2 old
|
|||
strace mount /dev/sda2 old
|
||||
```
|
||||
|
||||
|
||||
|
||||
将磁盘挂载到系统,写入配置文件避免每次都点击文件加载。
|
||||
|
||||
查看挂载
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
## 配置
|
||||
|
||||
```shell
|
||||
cat > coredns.yaml << "EOF"
|
||||
apiVersion: v1
|
||||
|
@ -202,7 +203,9 @@ spec:
|
|||
|
||||
EOF
|
||||
```
|
||||
|
||||
## 启动
|
||||
|
||||
```shell
|
||||
kubectl apply -f coredns.yaml
|
||||
```
|
||||
|
|
|
@ -21,5 +21,4 @@ vi /etc/named.rfc1912.zones
|
|||
|
||||
vi hy.com.zone
|
||||
systemctl start named
|
||||
|
||||
```
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
# push镜像使用http
|
||||
|
||||
```
|
||||
# 修改配置文件
|
||||
vi /etc/docker/daemon.json
|
||||
|
@ -28,4 +28,3 @@ docker tag 4d69ba36298c 172.21.13.108:80/platform-v3/jeecg-boot-system:3.1.0922-
|
|||
# 推送远程仓库
|
||||
docker push 172.21.13.108:80/platform-v3/jeecg-boot-system:3.1.0922-mdm
|
||||
```
|
||||
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
```shell
|
||||
```javascript
|
||||
# 设置容器总是重启
|
||||
docker update --restart=always f854fe55ed76
|
||||
```
|
||||
|
||||
# 查看网络
|
||||
docker network ls
|
||||
# 创建桥接网络task-manager
|
||||
docker network create --driver bridge task-manager
|
||||
# 将现有的容器8a74f2c64cdc连接到网络task-manager
|
||||
docker network connect task-manager 8a74f2c64cdc
|
||||
# 查看网络task-manager
|
||||
docker network inspect task-manager
|
||||
# 运行容器时使用网络task-manager
|
||||
docker run -d -p 8090:8090 --network task-manager --restart unless-stopped -v ./hosts:/etc/hosts --name task-manager-server task-manager-server
|
||||
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
配置文件地址
|
||||
|
||||
cat /etc/vsftpd.conf
|
||||
|
||||
日志地址
|
||||
|
||||
sudo cat /var/log/vsftpd.log
|
||||
|
||||
重启服务
|
||||
|
||||
sudo systemctl restart vsftpd
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,30 @@
|
|||
deb https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic main restricted universe multiverse
|
||||
deb https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-security main restricted universe multiverse
|
||||
deb https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-updates main restricted universe multiverse
|
||||
deb https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-proposed main restricted universe multiverse
|
||||
deb https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-backports main restricted universe multiverse
|
||||
deb-src https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic main restricted universe multiverse
|
||||
deb-src https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-security main restricted universe multiverse
|
||||
deb-src https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-updates main restricted universe multiverse
|
||||
deb-src https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-proposed main restricted universe multiverse
|
||||
deb-src https://mirrors.ustc.edu.cn/ubuntu-releases/ jammy bionic-backports main restricted universe multiverse
|
||||
|
||||
deb http://mirrors.aliyun.com/ubuntu/ jammy bionic main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ jammy bionic-security main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ jammy bionic-updates main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ jammy bionic-proposed main restricted universe multiverse
|
||||
deb http://mirrors.aliyun.com/ubuntu/ jammy bionic-backports main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy bionic main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy bionic-security main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy bionic-updates main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy bionic-proposed main restricted universe multiverse
|
||||
deb-src http://mirrors.aliyun.com/ubuntu/ jammy bionic-backports main restricted universe multiverse
|
||||
|
||||
deb http://cn.archive.ubuntu.com/ubuntu/ jammy xenial main restricted universe multiverse
|
||||
deb http://cn.archive.ubuntu.com/ubuntu/ jammy xenial-security main restricted universe multiverse
|
||||
deb http://cn.archive.ubuntu.com/ubuntu/ jammy xenial-updates main restricted universe multiverse
|
||||
deb http://cn.archive.ubuntu.com/ubuntu/ jammy xenial-backports main restricted universe multiverse
|
||||
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy xenial main restricted universe multiverse
|
||||
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy xenial-security main restricted universe multiverse
|
||||
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy xenial-updates main restricted universe multiverse
|
||||
deb-src http://cn.archive.ubuntu.com/ubuntu/ jammy xenial-backports main restricted universe multiverse
|
|
@ -0,0 +1,56 @@
|
|||
# 离线安装
|
||||
https://www.mongodb.com/try/download/community
|
||||
## 下载
|
||||
```shell
|
||||
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.25.tgz
|
||||
```
|
||||
## 解压
|
||||
```shell
|
||||
tar -zxvf mongodb-linux-x86_64-ubuntu1804-4.2.25.tgz
|
||||
```
|
||||
## 配置环境变量
|
||||
```shell
|
||||
# mongodb-install-directory 换为解压位置
|
||||
# sudo cp <mongodb-install-directory>/bin/* /usr/local/bin/
|
||||
sudo cp mongodb-linux-x86_64-ubuntu1804-4.2.25/bin/* /usr/local/bin/
|
||||
```
|
||||
|
||||
## 启动
|
||||
```shell
|
||||
mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork
|
||||
# 报错
|
||||
mongod: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
|
||||
# 全局查找文件
|
||||
find / -name 'libssl.so.1.1'
|
||||
# 复制到使用位置
|
||||
cp /snap/core18/2812/usr/lib/x86_64-linux-gnu/libssl.so.1.1 /usr/lib/libssl.so.1.1
|
||||
tail -f /var/log/mongodb/mongod.log
|
||||
waiting for connections on port 27017
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
# 查看数据库
|
||||
show dbs;
|
||||
# 创建切换数据库
|
||||
use testdb;
|
||||
# 先创建集合,类似数据库中的表
|
||||
db.createCollection("testtab")
|
||||
# 查看集合表
|
||||
show tables
|
||||
# 插入数据
|
||||
db.testdb.insertOne({"name":"菜鸟教程"})
|
||||
|
||||
db.testtab.insert({title: 'MongoDB 教程',
|
||||
description: 'MongoDB 是一个 Nosql 数据库',
|
||||
by: '教程',
|
||||
url: 'http://www.baidu.com',
|
||||
tags: ['mongodb', 'database', 'NoSQL'],
|
||||
likes: 100
|
||||
})
|
||||
# 查看信息
|
||||
db.testtab.find()
|
||||
# 修改
|
||||
db.testtab.update({'title':'MongoDB 教程'},{$set:{'title':'MongoDB MongoDB'}})
|
||||
```
|
|
@ -0,0 +1,27 @@
|
|||
# LBCC
|
||||
|
||||
Lock Base Concurrency Control 基于锁的并发控制。
|
||||
|
||||
# MVCC
|
||||
|
||||
Multi-Version Concurrency Control,即多版本并发控制
|
||||
|
||||
生成快照read view
|
||||
|
||||
隐藏字段,redolog
|
||||
|
||||
# 处理幻读
|
||||
|
||||
在一个事物中同时出现快照读,当前读和数据插入(另一个事物)会出现事物。
|
||||
|
||||
## 串行化
|
||||
|
||||
## 间隙锁
|
||||
|
||||
select * from user where age = 18 for update;
|
||||
|
||||
show engine innodb status\G;(需要开启参数innodb_status_output和innodb_status_output_lock)
|
||||
|
||||
# 锁根据索引处理
|
||||
|
||||
记录锁(行锁),间隙锁,临界锁
|
|
@ -2,6 +2,20 @@
|
|||
-- 查找参数
|
||||
SHOW GLOBAL VARIABLES;
|
||||
SHOW GLOBAL VARIABLES like 'offline_mode';
|
||||
-- 创建用户 允许任何ip连接
|
||||
CREATE USER 'closeToU8'@'%' IDENTIFIED BY 'frpPurchase8*';
|
||||
-- 授予权限
|
||||
GRANT SELECT, update ON frp_xiongbang.f_api_address TO 'closeToU8'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
select * from f_api_address where remarks like '%采购%'
|
||||
select * from f_api_address where id in ('11016','11006') and remarks like '%采购%'
|
||||
update f_api_address set delete_flag = 1 where id in ('11016','11006');
|
||||
|
||||
select * from f_api_address where id in ('11016','11006');
|
||||
|
||||
update f_api_address set delete_flag = 0 where id in ('11016','11006');
|
||||
|
||||
select * from f_api_address where id in ('11016','11006');
|
||||
```
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
## 连接不够
|
||||
|
||||
|
||||
|
||||
## 连接超时
|
|
@ -0,0 +1,33 @@
|
|||
# Innodb
|
||||
|
||||
存储文件有2个,表结构文件和索引数据文件,索引和数据在一个文件中,减少一次io。
|
||||
|
||||
# MySim
|
||||
|
||||
存储需要3个文件,表结构文件,索引文件和数据文件,先比Innodb多一次io。
|
||||
|
||||
# 二叉树
|
||||
|
||||
1. 二叉树
|
||||
2. BST树,Binary Search Tree,二叉搜索树
|
||||
3. AVL树
|
||||
4. 红黑树
|
||||
|
||||
# 多叉树
|
||||
|
||||
B-树,数据存储在节点上
|
||||
|
||||
B+树,数据存贮在最终叶子节点上
|
||||
|
||||
相同树高下B+数可以搜索更多数据。
|
||||
|
||||
一般情况下3-4层的B+数可以支持千万级别的数据量。
|
||||
|
||||
对于频繁更新的字段,最好不要添加索引。
|
||||
|
||||
数据迁移比较慢,可以先删除索引,数据迁移完成后,重新构建索引。
|
||||
|
||||
跟数据绑定的索引称为聚簇索引,没有跟数据绑定的索引称为非聚簇索引。
|
||||
|
||||
数据只存储一份,一个索引一个树,其他索引的叶子节点指向聚簇索引。
|
||||
|
|
@ -19,11 +19,20 @@ select * from information_schema.innodb_trx;
|
|||
kill trx_mysql_thread_id;
|
||||
select trx_mysql_thread_id from information_schema.innodb_trx where trx_state ='LOCK WAIT ';
|
||||
-- 查看所有进程
|
||||
SELECT * FROM information_schema.processlist
|
||||
show full processlist;
|
||||
```
|
||||
|
||||
```sql
|
||||
-- sql 执行时间
|
||||
show global variables where Variable_name = 'max_execution_time';
|
||||
SET GLOBAL MAX_EXECUTION_TIME=1000;
|
||||
SET SESSION MAX_EXECUTION_TIME=1000;
|
||||
SELECT max_execution_time=1000 SLEEP(10), a.* from test a;
|
||||
```
|
||||
|
||||
|
||||
select * from information_schema.`COLUMNS` where TABLE_SCHEMA='platform3_dev' and COLLATION_NAME='utf8mb4_unicode_ci' and TABLE_NAME like 'bfm_ems_equipment_maintenance%' and COLUMN_NAME LIKE '%id%' limit 1000;
|
||||
|
||||
|
||||
连接超时
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
## 下载地址
|
||||
|
||||
https://dev.mysql.com/downloads/mysql/
|
||||
[https://dev.mysql.com/downloads/mysql/](https://dev.mysql.com/downloads/mysql/)
|
||||
|
||||
## 下载版本
|
||||
|
||||
Linux Generic linux通用版本
|
||||
|
||||
```sh
|
||||
```javascript
|
||||
# 查看glibc版本
|
||||
[root@hy-node6 ~]# ldd --version
|
||||
ldd (GNU libc) 2.17
|
||||
|
@ -27,9 +27,9 @@ wget https://dev.mysql.com/get/Downloads/MySQL-8.1/mysql-8.1.0-linux-glibc2.17-x
|
|||
|
||||
## 安装参考地址
|
||||
|
||||
https://dev.mysql.com/doc/refman/8.1/en/binary-installation.html
|
||||
[https://dev.mysql.com/doc/refman/8.1/en/binary-installation.html](https://dev.mysql.com/doc/refman/8.1/en/binary-installation.html)
|
||||
|
||||
```sh
|
||||
```javascript
|
||||
# 添加用户组mysql 查看用户组 cat /etc/group
|
||||
groupadd mysql
|
||||
# 添加用户 hy-mysql并添加到用户组mysql 查看用户 cat /etc/passw
|
||||
|
@ -38,6 +38,7 @@ useradd -r -g mysql -s /bin/false hy-mysql
|
|||
tar xvf mysql-8.1.0-linux-glibc2.17-x86_64.tar
|
||||
# 解压
|
||||
xz -dc mysql-8.1.0-linux-glibc2.17-x86_64.tar.xz | tar x
|
||||
chmod 777 mysqld
|
||||
# 设置环境变量
|
||||
export PATH=$PATH:/software/mysql/mysql-8.1.0-linux-glibc2.17-x86_64/bin
|
||||
# 使环境变量生效
|
||||
|
@ -48,11 +49,11 @@ source /etc/profile
|
|||
|
||||
## 参考地址
|
||||
|
||||
https://dev.mysql.com/doc/refman/8.1/en/postinstallation.html
|
||||
[https://dev.mysql.com/doc/refman/8.1/en/postinstallation.html](https://dev.mysql.com/doc/refman/8.1/en/postinstallation.html)
|
||||
|
||||
## 配置文件地址
|
||||
|
||||
```sh
|
||||
```javascript
|
||||
# 备份配置文件
|
||||
cp my.cnf my.cnf.backup
|
||||
# 默认配置文件,不建议修改建议使用默认
|
||||
|
@ -67,7 +68,7 @@ basedir=/software/mysql/basedir
|
|||
socket=/software/mysql/socket/mysql.sock
|
||||
```
|
||||
|
||||
```
|
||||
```javascript
|
||||
# 设置地址授权,用于配置文件地址路径
|
||||
[root@hy-node6 mysql-8.1.0-linux-glibc2.17-x86_64]# pwd
|
||||
/software/mysql
|
||||
|
@ -87,9 +88,9 @@ socket=/software/mysql/socket/mysql.sock
|
|||
|
||||
## 使用systemctl启动
|
||||
|
||||
https://dev.mysql.com/doc/mysql-secure-deployment-guide/8.0/en/secure-deployment-post-install.html#secure-deployment-startup-options
|
||||
[https://dev.mysql.com/doc/mysql-secure-deployment-guide/8.0/en/secure-deployment-post-install.html#secure-deployment-startup-options](https://dev.mysql.com/doc/mysql-secure-deployment-guide/8.0/en/secure-deployment-post-install.html#secure-deployment-startup-options)
|
||||
|
||||
```
|
||||
```javascript
|
||||
cd /usr/lib/systemd/system
|
||||
touch mysqld.service
|
||||
chmod 644 mysqld.service
|
||||
|
@ -97,7 +98,7 @@ chmod 644 mysqld.service
|
|||
|
||||
写入文件
|
||||
|
||||
```
|
||||
```javascript
|
||||
[Unit]
|
||||
Description=MySQL Server
|
||||
Documentation=man:mysqld(8)
|
||||
|
@ -139,7 +140,7 @@ PrivateTmp=false
|
|||
|
||||
开始设置
|
||||
|
||||
```
|
||||
```javascript
|
||||
systemctl enable mysqld.service
|
||||
systemctl start mysqld
|
||||
systemctl status mysqld
|
||||
|
@ -150,7 +151,7 @@ systemctl status mysqld
|
|||
```sql
|
||||
mysql -u root -p
|
||||
# 修改密码
|
||||
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
|
||||
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; -- Sxh910911!
|
||||
# 设置远程连接
|
||||
CREATE USER 'root'@'127.0.0.1' IDENTIFIED BY '123456';
|
||||
CREATE USER 'root'@'::1' IDENTIFIED BY '123456';
|
||||
|
@ -161,8 +162,6 @@ GRANT ALL ON *.* TO 'root'@'%';
|
|||
flush privileges;
|
||||
```
|
||||
|
||||
|
||||
|
||||
# 遇到问题
|
||||
|
||||
## 一
|
||||
|
@ -184,7 +183,7 @@ ln -s /software/mysql/socket/mysql.sock /tmp/mysql.sock
|
|||
|
||||
修改配置文件/etc/my.conf 添加保证client和mysqld中socket相同
|
||||
|
||||
```
|
||||
```javascript
|
||||
[client]
|
||||
port=3306
|
||||
socket=/software/mysql/socket/mysql.sock
|
||||
|
@ -192,15 +191,14 @@ socket=/software/mysql/socket/mysql.sock
|
|||
|
||||
# 多实例启动
|
||||
|
||||
https://dev.mysql.com/doc/refman/8.1/en/using-systemd.html
|
||||
[https://dev.mysql.com/doc/refman/8.1/en/using-systemd.html](https://dev.mysql.com/doc/refman/8.1/en/using-systemd.html)
|
||||
|
||||
# 从机安装
|
||||
|
||||
复制安装包
|
||||
|
||||
```
|
||||
```javascript
|
||||
scp mysql-8.1.0-linux-glibc2.17-x86_64.tar.xz root@192.168.1.120:/software/mysql
|
||||
|
||||
root@localhost: %mfSO2t==tkF
|
||||
```
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue