提交
This commit is contained in:
parent
de86bc7c15
commit
6b6ea4321c
@ -1930,3 +1930,31 @@ public class AggregatorService : Aggregator.AggregatorBase
|
||||
}
|
||||
```
|
||||
|
||||
# Swagger
|
||||
|
||||
## CustomSchemaIds
|
||||
|
||||
CustomSchemaIds方法用于自定义SchemaId,Swashbuckle中的每个Schema都有唯一的Id,框架会使用这个Id匹配引用类型,因此这个Id不能重复。
|
||||
|
||||
默认情况下,这个Id是根据类名得到的(不包含命名空间),因此,当我们有两个相同名称的类时,Swashbuckle就会报错:
|
||||
|
||||
```
|
||||
System.InvalidOperationException: Can't use schemaId "$XXXXX" for type "$XXXX.XXXX". The same schemaId is already used for type "$XXXX.XXXX.XXXX"
|
||||
```
|
||||
|
||||
就是类似上面的异常,一般时候我们都得去改类名,有点不爽,这时就可以使用这个方法自己自定义实现SchemaId的获取,比如,我们自定义实现使用类名的全限定名(包含命名空间)来生成SchemaId,上面的异常就没有了:
|
||||
|
||||
```c#
|
||||
options.CustomSchemaIds(CustomSchemaIdSelector);
|
||||
|
||||
string CustomSchemaIdSelector(Type modelType)
|
||||
{
|
||||
if (!modelType.IsConstructedGenericType) return modelType.FullName.Replace("[]", "Array");
|
||||
|
||||
var prefix = modelType.GetGenericArguments()
|
||||
.Select(genericArg => CustomSchemaIdSelector(genericArg))
|
||||
.Aggregate((previous, current) => previous + current);
|
||||
|
||||
return prefix + modelType.FullName.Split('`').First();
|
||||
}
|
||||
```
|
||||
|
||||
@ -474,7 +474,7 @@ flush privileges;
|
||||
|
||||
---
|
||||
|
||||
### AlmaLinux 安装
|
||||
### AlmaLinux 安装 (dnf包管理器方式)
|
||||
|
||||
1. 首先确保系统是最新的。
|
||||
|
||||
@ -552,6 +552,92 @@ flush privileges;
|
||||
```
|
||||
|
||||
|
||||
### AlmaLinux 安装 (rpm手动方式)
|
||||
|
||||
```shell
|
||||
mkdir mysql_install
|
||||
cd mysql_install
|
||||
# 下载安装包
|
||||
wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.41-1.el7.x86_64.rpm-bundle.tar
|
||||
tar -xvf mysql-5.7.41-1.el7.x86_64.rpm-bundle.tar
|
||||
rpm -ivh mysql-community-common-5.7.41-1.el7.x86_64.rpm
|
||||
rpm -ivh mysql-community-libs-5.7.41-1.el7.x86_64.rpm
|
||||
rpm -ivh mysql-community-libs-compat-5.7.41-1.el7.x86_64.rpm
|
||||
rpm -ivh mysql-community-devel-5.7.41-1.el7.x86_64.rpm
|
||||
rpm -ivh mysql-community-client-5.7.41-1.el7.x86_64.rpm
|
||||
# 如果出现以下错误
|
||||
错误:依赖检测失败:
|
||||
libncurses.so.5()(64bit) 被 mysql-community-client-5.7.41-1.el7.x86_64 需要
|
||||
libtinfo.so.5()(64bit) 被 mysql-community-client-5.7.41-1.el7.x86_64 需要
|
||||
dnf install libncurses* -y
|
||||
# 再次执行 rpm -ivh mysql-community-client-5.7.41-1.el7.x86_64.rpm
|
||||
rpm -ivh mysql-community-server-5.7.41-1.el7.x86_64.rpm
|
||||
# 如果出现以下提示
|
||||
/usr/lib/tmpfiles.d/mysql.conf:23: Line references path below legacy directory /var/run/, updating /var/run/mysqld → /run/mysqld; please update the tmpfiles.d/ drop-in file accordingly.
|
||||
vim /usr/lib/tmpfiles.d/mysql.conf
|
||||
# 将/var/run/mysqld 改为 /run/mysqld
|
||||
# 再次执行 rpm -ivh mysql-community-server-5.7.41-1.el7.x86_64.rpm
|
||||
rpm -ivh mysql-community-embedded-compat-5.7.41-1.el7.x86_64.rpm
|
||||
|
||||
```
|
||||
|
||||
**编辑配置文件**
|
||||
|
||||
```shell
|
||||
vim /etc/my.cnf
|
||||
|
||||
# For advice on how to change settings please see
|
||||
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
|
||||
[client]
|
||||
port = 3306
|
||||
user = mysql
|
||||
|
||||
[mysqld]
|
||||
#
|
||||
# Remove leading # and set to the amount of RAM for the most important data
|
||||
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
|
||||
# innodb_buffer_pool_size = 128M
|
||||
#
|
||||
# Remove leading # to turn on a very important data integrity option: logging
|
||||
# changes to the binary log between backups.
|
||||
# log_bin
|
||||
#
|
||||
# Remove leading # to set options mainly useful for reporting servers.
|
||||
# The server defaults are faster for transactions and fast SELECTs.
|
||||
# Adjust sizes as needed, experiment to find the optimal values.
|
||||
# join_buffer_size = 128M
|
||||
# sort_buffer_size = 2M
|
||||
# read_rnd_buffer_size = 2M
|
||||
basedir=/usr/local/mysql
|
||||
datadir=/var/lib/mysql
|
||||
socket=/var/lib/mysql/mysql.sock
|
||||
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
|
||||
log-error=/var/log/mysqld.log
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
|
||||
max_connections = 400
|
||||
character-set-server = utf8mb4
|
||||
explicit_defaults_for_timestamp = true
|
||||
lower_case_table_names = 1
|
||||
```
|
||||
|
||||
**初始化**
|
||||
|
||||
```shell
|
||||
mysqld --defaults-file=/etc/my.cnf --initialize-insecure --user=mysql
|
||||
# 给mysql用户添加数据目录权限
|
||||
chown mysql:mysql /var/lib/mysql -R
|
||||
systemctl start mysqld
|
||||
systemctl enable mysqld
|
||||
|
||||
# 查看root随机生成密码
|
||||
grep 'temporary password' /var/log/mysqld.log
|
||||
# 若没有提示,则没有密码,可直接登录
|
||||
mysql -uroot
|
||||
```
|
||||
|
||||
## 配置Java环境变量
|
||||
|
||||
|
||||
@ -45,6 +45,40 @@ mysqldump -uroot -p test --no-data > test.sql
|
||||
mysqldump -uroot -p -B test > test.sql
|
||||
```
|
||||
|
||||
# Xtrabackup备份数据库
|
||||
|
||||
## 安装
|
||||
|
||||
### wget方式
|
||||
|
||||
1. 安装qpress rpm包。
|
||||
```shell
|
||||
wget https://repo.percona.com/yum/release/7/RPMS/x86_64/qpress-11-1.el9.x86_64.rpm
|
||||
rpm -ivh qpress-11-1.el9.x86_64.rpm
|
||||
```
|
||||
|
||||
2. 安装Percona XtraBackup
|
||||
|
||||
- MySQL 5.6、5.7,以下载并安装Percona XtraBackup 2.4.9为例
|
||||
```shell
|
||||
wget https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.9/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.9-1.el9.x86_64.rpm
|
||||
|
||||
rpm -ivh percona-xtrabackup-24-2.4.9-1.el7.x86_64.rpm --nodeps --force
|
||||
```
|
||||
|
||||
- MySQL 8.0,以下载并安装Percona XtraBackup 8.0为例
|
||||
```shell
|
||||
wget https://downloads.percona.com/downloads/Percona-XtraBackup-8.0/Percona-XtraBackup-8.0.32-26/binary/redhat/7/x86_64/percona-xtrabackup-80-8.0.32-26.1.el7.x86_64.rpm
|
||||
|
||||
rpm -ivh percona-xtrabackup-80-8.0.32-26.1.el7.x86_64.rpm --nodeps --force
|
||||
```
|
||||
|
||||
## 恢复
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Windows 下安装 绿色版
|
||||
|
||||
先下载[MySQL :: Download MySQL Community Server](https://dev.mysql.com/downloads/mysql/)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user