Mysql(MGR)和ProxySQL搭建部署-Kubernetes版本
一、Mysql(MGR)
1.1 statefulSet.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:labels:app: mysqlname: mysqlnamespace: yihuazt
spec:replicas: 3serviceName: mysql-headlessselector:matchLabels:app: mysqltemplate:metadata:labels:app: mysqlspec:affinity:podAntiAffinity:requiredDuringSchedulingIgnoredDuringExecution:- labelSelector:matchExpressions:- key: appoperator: Invalues:- mysqltopologyKey: "kubernetes.io/hostname"containers:- name: mysqlimage: registry.harbor.com:30002/yihuazt/mysql:8.0.28resources:requests:cpu: "1"memory: "1024Mi"volumeMounts:- name: mysql-datamountPath: /var/lib/mysql/- name: mysql-cmmountPath: /etc/mysql/my.cnfsubPathExpr: $(POD_NAME).cnf- name: mysql-cmmountPath: /docker-entrypoint-initdb.d/init.sqlsubPath: init.sql- name: mysql-cmmountPath: /var/lib/mysql-files/proxysql.sqlsubPath: proxysql.sqlports:- containerPort: 3306- containerPort: 24901env:- name: TZvalue: "Asia/Shanghai"- name: MYSQL_ROOT_PASSWORDvalueFrom:secretKeyRef:name: mysql-certkey: password- name: POD_IPvalueFrom:fieldRef:apiVersion: v1fieldPath: status.podIP- name: POD_NAMEvalueFrom:fieldRef:apiVersion: v1fieldPath: metadata.namevolumes:- name: mysql-cmconfigMap:name: mysql-cmitems:- key: mysql-0.cnfpath: mysql-0.cnf- key: mysql-1.cnfpath: mysql-1.cnf- key: mysql-2.cnfpath: mysql-2.cnf- key: init.sqlpath: init.sql- key: proxysql.sqlpath: proxysql.sqlvolumeClaimTemplates:- metadata:name: mysql-dataspec:accessModes:- ReadWriteOnceresources:requests:storage: 100GistorageClassName: yihuazt-nfsvolumeMode: Filesystem
1.2 service.yaml
apiVersion: v1
kind: Service
metadata:name: mysql-headlessnamespace: yihuazt
spec:ports:- name: mysqlprotocol: TCPport: 3306targetPort: 3306- name: mgrprotocol: TCPport: 24901targetPort: 24901selector:app: mysqlclusterIP: Nonetype: ClusterIP
1.3 configMap.yaml
注意:
# 用于限制哪些 IP 地址或 IP 网段可以与 Group Replication 集群进行通信
,由于k8s部署Pod是不同网段,
跨网段的 MySQL 实例进行 Group Replication必须配置参数,指定哪些 IP 地址或子网允许连接。
- loose-group_replication_ip_whitelist='10.244.0.0/16'
# 用于设置主机名(hostname)的配置参数。这个参数通常用于配置 MySQL Replication 环境中的主机名。如果未配置,MGR集群主机名与无头服务DNS不匹配,通讯失败。
- report_host=mysql-1.mysql-headless.yihuazt.svc.cluster.local
# server_id一定不能设置为0
- server_id=1
apiVersion: v1
kind: ConfigMap
metadata:name: mysql-cmnamespace: yihuaztlabels:app: mysql
data:mysql-0.cnf: |# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; version 2 of the License.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA## The MySQL Server configuration file.## For explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html[mysqld]pid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockdatadir = /var/lib/mysqlsecure-file-priv= NULL# Custom config should go here!includedir /etc/mysql/conf.d/default_authentication_plugin=mysql_native_passwordplugin_dir=/usr/lib/mysql/pluginserver_id=1gtid_mode=ONenforce_gtid_consistency=ONbinlog_checksum=NONEtransaction_write_set_extraction=XXHASH64loose-group_replication_recovery_use_ssl=ONloose-group_replication_group_name="bbbbbbbb-bbbb-cccc-dddd-eeeeeeeeeeee"loose-group_replication_start_on_boot=OFFloose-group_replication_local_address="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901"loose-group_replication_group_seeds="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"loose-group_replication_bootstrap_group=OFFloose-group_replication_ip_whitelist='10.244.0.0/16'report_host=mysql-0.mysql-headless.yihuazt.svc.cluster.localmysql-1.cnf: |# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; version 2 of the License.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA## The MySQL Server configuration file.## For explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html[mysqld]pid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockdatadir = /var/lib/mysqlsecure-file-priv= NULL# Custom config should go here!includedir /etc/mysql/conf.d/default_authentication_plugin=mysql_native_passwordplugin_dir=/usr/lib/mysql/pluginserver_id=2gtid_mode=ONenforce_gtid_consistency=ONbinlog_checksum=NONEloose-group_replication_recovery_get_public_key=ONloose-group_replication_recovery_use_ssl=ONloose-group_replication_group_name="bbbbbbbb-bbbb-cccc-dddd-eeeeeeeeeeee"loose-group_replication_start_on_boot=OFFloose-group_replication_local_address="mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901"loose-group_replication_group_seeds="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"loose-group_replication_bootstrap_group=OFFloose-group_replication_ip_whitelist='10.244.0.0/16'report_host=mysql-1.mysql-headless.yihuazt.svc.cluster.localmysql-2.cnf: |# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; version 2 of the License.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA## The MySQL Server configuration file.## For explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html[mysqld]pid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockdatadir = /var/lib/mysqlsecure-file-priv= NULL# Custom config should go here!includedir /etc/mysql/conf.d/default_authentication_plugin=mysql_native_passwordplugin_dir=/usr/lib/mysql/pluginserver_id=3gtid_mode=ONenforce_gtid_consistency=ONbinlog_checksum=NONEloose-group_replication_recovery_get_public_key=ONloose-group_replication_recovery_use_ssl=ONloose-group_replication_group_name="bbbbbbbb-bbbb-cccc-dddd-eeeeeeeeeeee"loose-group_replication_start_on_boot=OFFloose-group_replication_local_address="mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"loose-group_replication_group_seeds="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"loose-group_replication_bootstrap_group=OFFloose-group_replication_ip_whitelist='10.244.0.0/16'report_host=mysql-2.mysql-headless.yihuazt.svc.cluster.localinit.sql: |CREATE USER rpl_user@'%' IDENTIFIED BY 'asAS123456!';GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';FLUSH PRIVILEGES;RESET MASTER;INSTALL PLUGIN group_replication SONAME 'group_replication.so';/*SELECT * FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'group_replication' \G;*/CHANGE MASTER TO MASTER_USER="rpl_user", MASTER_PASSWORD="asAS123456!" FOR CHANNEL 'group_replication_recovery';/*SET GLOBAL group_replication_bootstrap_group=ON;START GROUP_REPLICATION;SET GLOBAL group_replication_bootstrap_group=OFF;SELECT * FROM performance_schema.replication_group_members;*/proxysql.sql: |/*mysql -uroot -prootmcafee123 < /var/lib/mysql-files/proxysql.sql*/use sys;DELIMITER $$CREATE USER 'monitor'@'%' IDENTIFIED BY "monitor@1025";CREATE USER 'proxysql'@'%' IDENTIFIED BY "proxysql@1025";GRANT ALL PRIVILEGES ON *.* TO 'monitor'@'%' ;GRANT ALL PRIVILEGES ON *.* TO 'proxysql'@'%' ;FLUSH PRIVILEGES;CREATE FUNCTION my_id() RETURNS TEXT(36) DETERMINISTIC NO SQL RETURN (SELECT @@global.server_uuid as my_id);$$CREATE FUNCTION gr_member_in_primary_partition()RETURNS VARCHAR(3)DETERMINISTICBEGINRETURN (SELECT IF( MEMBER_STATE='ONLINE' AND ((SELECT COUNT(*) FROMperformance_schema.replication_group_members WHERE MEMBER_STATE NOT IN ('ONLINE', 'RECOVERING')) >=((SELECT COUNT(*) FROM performance_schema.replication_group_members)/2) = 0),'YES', 'NO' ) FROM performance_schema.replication_group_members JOINperformance_schema.replication_group_member_stats USING(member_id) where member_id=my_id());END$$CREATE VIEW gr_member_routing_candidate_status AS SELECTsys.gr_member_in_primary_partition() as viable_candidate,IF( (SELECT (SELECT GROUP_CONCAT(variable_value) FROMperformance_schema.global_variables WHERE variable_name IN ('read_only','super_read_only')) != 'OFF,OFF'), 'YES', 'NO') as read_only,Count_Transactions_Remote_In_Applier_Queue as transactions_behind, Count_Transactions_in_queue as 'transactions_to_cert'from performance_schema.replication_group_member_stats where member_id=my_id();$$
1.4 secret.yml
echo -n "rootmcafee123" | base64
echo "cm9vdG1jYWZlZTEyMw==" | base64 --decode
apiVersion: v1
kind: Secret
metadata:name: mysql-certnamespace: yihuazt
type: Opaque
data:password: cm9vdG1jYWZlZTEyMw==
二、ProxySQL
2.1 deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:name: proxysqlnamespace: yihuazt
spec:replicas: 1selector:matchLabels:app: proxysqltemplate:metadata:labels:app: proxysqlspec:containers:- name: proxysqlimage: registry.harbor.com:30002/yihuazt/proxysql:2.6.5ports:- containerPort: 6033- containerPort: 6032- containerPort: 6070env:- name: TZvalue: "Asia/Shanghai"volumeMounts:- name: proxysql-datamountPath: /var/lib/proxysql- name: proxysql-configmountPath: /etc/proxysql.cnfsubPath: proxysql.cnfvolumes:- name: proxysql-configconfigMap:name: proxysql-cmitems:- key: proxysql.cnfpath: proxysql.cnf- name: proxysql-datapersistentVolumeClaim:claimName: proxysql-pvc
2.2 service.yaml
apiVersion: v1
kind: Service
metadata:name: proxysqlnamespace: yihuazt
spec:selector:app: proxysqltype: NodePortports:- port: 6033targetPort: 6033nodePort: 30633name: external
2.3 persistentVolumeClaim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: proxysql-pvcnamespace: yihuazt
spec:storageClassName: "yihuazt-nfs"accessModes:- ReadWriteOnceresources:requests:storage: 30Gi
2.4 configMap.yaml
apiVersion: v1
kind: ConfigMap
metadata:name: proxysql-cmnamespace: yihuaztlabels:app: proxysql
data:proxysql.cnf: |#file proxysql.cfg######################################################################################### This config file is parsed using libconfig , and its grammar is described in: # http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar # Grammar is also copied at the end of this file ################################################################################################################################################################################# IMPORTANT INFORMATION REGARDING THIS CONFIGURATION FILE: ######################################################################################### On startup, ProxySQL reads its config file (if present) to determine its datadir. # What happens next depends on if the database file (disk) is present in the defined# datadir (i.e. "/var/lib/proxysql/proxysql.db").## If the database file is found, ProxySQL initializes its in-memory configuration from # the persisted on-disk database. So, disk configuration gets loaded into memory and # then propagated towards the runtime configuration. ## If the database file is not found and a config file exists, the config file is parsed # and its content is loaded into the in-memory database, to then be both saved on-disk # database and loaded at runtime.## IMPORTANT: If a database file is found, the config file is NOT parsed. In this case# ProxySQL initializes its in-memory configuration from the persisted on-disk# database ONLY. In other words, the configuration found in the proxysql.cnf# file is only used to initial the on-disk database read on the first startup.## In order to FORCE a re-initialise of the on-disk database from the configuration file # the ProxySQL service should be started with "systemctl start proxysql-initial".#########################################################################################datadir="/var/lib/proxysql"errorlog="/var/lib/proxysql/proxysql.log"admin_variables={admin_credentials="admin:admin"# mysql_ifaces="127.0.0.1:6032;/tmp/proxysql_admin.sock"mysql_ifaces="0.0.0.0:6032"# refresh_interval=2000# debug=true}mysql_variables={threads=4max_connections=2048default_query_delay=0default_query_timeout=36000000have_compress=truepoll_timeout=2000# interfaces="0.0.0.0:6033;/tmp/proxysql.sock"interfaces="0.0.0.0:6033"default_schema="information_schema"stacksize=1048576server_version="8.0.28 (ProxySQL)"connect_timeout_server=3000# make sure to configure monitor username and password# https://github.com/sysown/proxysql/wiki/Global-variables#mysql-monitor_username-mysql-monitor_passwordmonitor_username="monitor"monitor_password="monitor@1025"monitor_history=600000monitor_connect_interval=60000monitor_ping_interval=10000monitor_read_only_interval=1500monitor_read_only_timeout=500ping_interval_server_msec=120000ping_timeout_server=500commands_stats=truesessions_sort=trueconnect_retries_on_failure=10}# defines all the MySQL serversmysql_servers =(# {# address = "127.0.0.1" # no default, required . If port is 0 , address is interpred as a Unix Socket Domain# port = 3306 # no default, required . If port is 0 , address is interpred as a Unix Socket Domain# hostgroup = 0 # no default, required# status = "ONLINE" # default: ONLINE# weight = 1 # default: 1# compression = 0 # default: 0# max_replication_lag = 10 # default 0 . If greater than 0 and replication lag passes such threshold, the server is shunned# },# {# address = "/var/lib/mysql/mysql.sock"# port = 0# hostgroup = 0# },# {# address="127.0.0.1"# port=21891# hostgroup=0# max_connections=200# },# { address="127.0.0.2" , port=3306 , hostgroup=0, max_connections=5 },# { address="127.0.0.1" , port=21892 , hostgroup=1 },# { address="127.0.0.1" , port=21893 , hostgroup=1 }# { address="127.0.0.2" , port=3306 , hostgroup=1 },# { address="127.0.0.3" , port=3306 , hostgroup=1 },# { address="127.0.0.4" , port=3306 , hostgroup=1 },# { address="/var/lib/mysql/mysql.sock" , port=0 , hostgroup=1 }{ address="mysql-0.mysql-headless.yihuazt.svc.cluster.local" , port=3306 , hostgroup=10 }, { address="mysql-1.mysql-headless.yihuazt.svc.cluster.local" , port=3306 , hostgroup=10 }, { address="mysql-2.mysql-headless.yihuazt.svc.cluster.local" , port=3306 , hostgroup=10 })# defines all the MySQL usersmysql_users:(# {# username = "username" # no default , required# password = "password" # default: ''# default_hostgroup = 0 # default: 0# active = 1 # default: 1# },# {# username = "root"# password = ""# default_hostgroup = 0# max_connections=1000# default_schema="test"# active = 1# },# { username = "user1" , password = "password" , default_hostgroup = 0 , active = 0 }{username = "proxysql"password = "proxysql@1025"active = 1default_hostgroup = 10transaction_persistent = 1})#defines MySQL Query Rulesmysql_query_rules:(# {# rule_id=1# active=1# match_pattern="^SELECT .* FOR UPDATE$"# destination_hostgroup=0# apply=1# },# {# rule_id=2# active=1# match_pattern="^SELECT"# destination_hostgroup=1# apply=1# }{rule_id=1active=1match_digest="^SELECT.*FOR UPDATE$"destination_hostgroup=10apply=1},{rule_id=2active=1match_digest="^SELECT"destination_hostgroup=30apply=1})scheduler=(# {# id=1# active=0# interval_ms=10000# filename="/var/lib/proxysql/proxysql_galera_checker.sh"# arg1="0"# arg2="0"# arg3="0"# arg4="1"# arg5="/var/lib/proxysql/proxysql_galera_checker.log"# })mysql_replication_hostgroups=(# {# writer_hostgroup=30# reader_hostgroup=40# comment="test repl 1"# },# {# writer_hostgroup=50# reader_hostgroup=60# comment="test repl 2"# })mysql_group_replication_hostgroups=({writer_hostgroup=10backup_writer_hostgroup=20reader_hostgroup=30offline_hostgroup=40active=1max_writers=1writer_is_also_reader=0max_transactions_behind=100})# http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar## Below is the BNF grammar for configuration files. Comments and include directives are not part of the grammar, so they are not included here. ## configuration = setting-list | empty## setting-list = setting | setting-list setting# # setting = name (":" | "=") value (";" | "," | empty)# # value = scalar-value | array | list | group# # value-list = value | value-list "," value# # scalar-value = boolean | integer | integer64 | hex | hex64 | float# | string# # scalar-value-list = scalar-value | scalar-value-list "," scalar-value# # array = "[" (scalar-value-list | empty) "]"# # list = "(" (value-list | empty) ")"# # group = "{" (setting-list | empty) "}"# # empty =
运行方法与Docker部署一致,差异性的地方已经说明
相关文章:
Mysql(MGR)和ProxySQL搭建部署-Kubernetes版本
一、Mysql(MGR) 1.1 statefulSet.yaml apiVersion: apps/v1 kind: StatefulSet metadata:labels:app: mysqlname: mysqlnamespace: yihuazt spec:replicas: 3serviceName: mysql-headlessselector:matchLabels:app: mysqltemplate:metadata:labels:app: mysqlspec:affinity:p…...
uni-app 多平台分享实现指南
uni-app 多平台分享实现指南 在移动应用开发中,分享功能是一个非常常见的需求,尤其是在社交媒体、营销活动等场景中。使用 uni-app 进行多平台开发时,可以通过一套代码实现跨平台的分享功能,涵盖微信小程序、H5、App 等多个平台。…...
Windows系统下载、部署Node.js与npm环境的方法
本文介绍在Windows电脑中,下载、安装并配置Node.js环境与npm包管理工具的方法。 Node.js是一个基于Chrome V8引擎的JavaScript运行时环境,其允许开发者使用JavaScript编写命令行工具和服务器端脚本。而npm(Node Package Manager)则…...
Typora 最新版本下载安装教程(附详细图文)
文章简介 在当今快节奏的信息化时代,简洁高效的写作工具成为了每位内容创作者的必需品。而Typora,这款备受推崇的 Markdown 编辑器,正是为此而生。它采用无缝设计,去除了模式切换、预览窗口等干扰,带来真正的实时预览…...
将一个变量声明为全局变量比如:flag1=false;然后通过jQuery使用js一个方法,将它设置为不可修改
方法 1:使用 Object.defineProperty 通过 Object.defineProperty 将全局变量设置为只读属性。 // 声明全局变量 var flag1 false;// 使用 Object.defineProperty 将其设置为不可修改 Object.defineProperty(window, flag1, {configurable: false, // 不允许删除属…...
找不到qt5core.dll无法运用软件的解决办法
在运行某些软件或游戏时,部分用户会遇到电脑显示由于找不到qt5core.dll,无法继续执行代码的问题,下面就给大家分享几种简单的解决方法,轻松恢复软件正常运行。 导致qt5core.dll缺失的原因 qt5core.dll是 Qt 应用程序框架的一部分…...
集线器,交换机,路由器,mac地址和ip地址知识记录总结
一篇很不错的视频简介 基本功能 从使用方面来说,都是为了网络传输的标识,和机器确定访问对象 集线器、交换机和路由器 常听到路由器和集线器,下面是区别: 集线器 集线器:一个简单的物理扩展接口数量的物理硬件。…...
Javascript算法——回溯算法(组合问题)
相关资料来自《代码随想录》,版权归原作者所有,只是学习记录 回溯 回溯模板 void backtracking(参数) {if (终止条件) {存放结果;return;}for (选择:本层集合中元素(树中节点孩子的数量就是集合的大小)) {处理节点…...
【人工智能机器学习基础篇】——深入详解无监督学习之聚类,理解K-Means、层次聚类、数据分组和分类
深入详解无监督学习之聚类:如K-Means、层次聚类,理解数据分组和分类 无监督学习是机器学习中的一个重要分支,旨在从未标注的数据中发现潜在的结构和模式。聚类(Clustering)作为无监督学习的核心任务之一,广…...
从0到机器视觉工程师(二):封装调用静态库和动态库
目录 静态库 编写静态库 使用静态库 方案一 方案二 动态库 编写动态库 使用动态库 方案一 方案二 方案三 总结 静态库 静态库是在编译时将库的代码合并到最终可执行程序中的库。静态库的优势是在编译时将所有代码包含在程序中,可以使程序独立运行&…...
Mybatis的set标签,动态SQL
set标签常用于update语句中,搭配if标签使用 set标签的作用 1、会动态加上前置set关键字 2、可以删除无关的逗号 示例代码: <update id"update">update employee<set><if test"name ! null">name #{name},<…...
机器学习-感知机-神经网络-激活函数-正反向传播-梯度消失-dropout
文章目录 感知机工作流程 神经网络区别各种各样的神经网络 激活函数激活函数类型Sigmoid 函数ReLU函数Leaky ReLU 函数Tanh 函数 正向传播反向传播梯度消失(gradient vanish)如何解决 Dropout使用 PyTorch实战神经网络算法(手写MNIST数字识别)viewsoftmax和log-softmaxcross-en…...
HTML5 时间选择器详解
HTML5 的时间选择器(Time Picker)允许用户通过图形界面选择时间。它通过设置 <input> 元素的 type 属性为 time 来实现。以下是关于 HTML5 时间选择器的详细讲解。 HTML5 时间选择器详解 1. 基本用法 要创建一个时间选择器,只需使用…...
SSM-Spring-AOP
目录 1 AOP实现步骤(以前打印当前系统的时间为例) 2 AOP工作流程 3 AOP核心概念 4 AOP配置管理 4-1 AOP切入点表达式 4-1-1 语法格式 4-1-2 通配符 4-2 AOP通知类型 五种通知类型 AOP通知获取数据 获取参数 获取返回值 获取异常 总结 5 …...
小红书笔记详情API分析及读取深度探讨
一、引言 随着社交电商的蓬勃发展,小红书凭借其独特的社区氛围和强大的内容生产能力,吸引了大量用户和开发者。对于开发者而言,小红书提供的API接口是获取其丰富内容的重要途径。本文将对小红书笔记详情API进行深入分析,并详细阐…...
【Yarn】通过JMX采集yarn相关指标的Flink任务核心逻辑
通过JMX采集yarn相关指标的Flink任务核心逻辑 文章目录 通过JMX采集yarn相关指标的Flink任务核心逻辑通过jmx接口查询Yarn队列指标请求JMX配置项核心处理流程输出到kafka格式通过jmx接口查询ResourceManager核心指标请求JMX读取配置yaml配置文件核心处理逻辑输出Kafka格式彩蛋 …...
【网络安全】PostMessage:分析JS实现XSS
前言 PostMessage是一个用于在网页间安全地发送消息的浏览器 API。它允许不同的窗口(例如,来自同一域名下的不同页面或者不同域名下的跨域页面)进行通信,而无需通过服务器。通常情况下,它用于实现跨文档消息传递&…...
基于springboot的码头船只货柜管理系统 P10078
项目说明 本号所发布的项目均由我部署运行验证,可保证项目系统正常运行,以及提供完整源码。 如需要远程部署/定制/讲解系统,可以联系我。定制项目未经同意不会上传! 项目源码获取方式放在文章末尾处 注:项目仅供学…...
SpringMVC(二)原理
目录 一、配置Maven(为了提升速度) 二、流程&&原理 SpringMVC中心控制器 完整流程: 一、配置Maven(为了提升速度) 在SpringMVC(一)配置-CSDN博客的配置中,导入Maven会非…...
计算机网络:网络层知识点及习题(一)
网课资源: 湖科大教书匠 1、概述 网络层实现主机到主机的传输,主要有分组转发和路由选择两大功能 路由选择处理机得出路由表,路由表再生成转发表,从而实现分组从不同的端口转发 网络层向上层提供的两种服务:面向连接…...
题解:A. Noldbach Problem
问题描述 Nick 对素数非常感兴趣。他阅读了有关 Goldbach Problem 的内容,了解到每个大于 2 的偶数都可以表示为两个素数的和。于是他决定创造一个新问题,称为 Noldbach Problem。 Noldbach 问题的定义如下: 如果一个素数 $p$ 满足&#x…...
ESP32S3 + IDF 5.2.2 扫描WiFi
ESP32S3 IDF 5.2.2 扫描WiFi 目录 1 资料 2 通过Wi-Fi库扫描附近的网络 2.1 通过idf命令创建工程 2.2 编写测试用例 2.3 优化测试用例 3 小结 1 资料 在ESP平台基于IDF开发WiFi相关功能,主要就是基于IDF的Wi-Fi库进行二次开发。可供参考的官方资料ÿ…...
鸿蒙开发汇总
写在前面 汇总贴,整理在开发过程中遇到的有趣的、不太好解决的问题,记录一下思考的过程及自己的解决方案。 只做为技术分享,转载请标明出处。 ArkTs-this指向问题 ArkTs-Text组件长度计算不对的问题...
PDF阅读和编辑工具——xodo
本文给大家推荐一款好用的PDF阅读和编辑工具——xodo,一款免费的跨平台PDF阅读、编辑、批注工具。 注意xodo PDF Reader是免费的,xodo PDF Studio是收费的,但是xodo PDF Studio功能多很多。...
QT-------------自定义插件和库
以下是一个使用 Qt 实现图表交互操作的示例,涵盖了自定义图表视图类、不同类型的柱状图和饼图等内容。 实现思路 自定义图表视图类:创建一个从 QChartView 派生的自定义类,用于处理图表的交互操作。主窗口设计初始化:在主窗口中…...
《云原生安全攻防》-- K8s安全配置:CIS安全基准与kube-bench工具
在本节课程中,我们来了解一下K8s集群的安全配置,通过对CIS安全基准和kube-bench工具的介绍,可以快速发现K8s集群中不符合最佳实践的配置项,及时进行修复,从而来提高集群的安全性。 在这个课程中,我们将学习…...
PCA降维算法详细推导
关于一个小小的PCA的推导 文章目录 关于一个小小的PCA的推导1 谱分解 (spectral decomposition)2 奇异矩阵(singular matrix)3 酉相似(unitary similarity)4 酉矩阵5 共轭变换6 酉等价7 矩阵的迹的计算以及PCA算法推导8 幂等矩阵(idempotent matrix)9 Von Neumanns 迹不等式 [w…...
C++ 基础思维导图(一)
目录 1、C基础 IO流 namespace 引用、const inline、函数参数 重载 2、类和对象 类举例 3、 内存管理 new/delete 对象内存分布 内存泄漏 4、继承 继承权限 继承中的构造与析构 菱形继承 1、C基础 IO流 #include <iostream> #include <iomanip> //…...
Excel文件恢复教程:快速找回丢失数据!
Excel文件恢复位置在哪里? Excel是微软开发的电子表格软件,它为处理数据和组织工作提供了便捷。虽然数据丢失的问题在数字时代已经司空见惯,但对于某些用户来说,恢复未保存/删除/丢失的Excel文件可能会很困难,更不用说…...
人脑处理信息的速度与效率:超越计算机的直观判断能力
人脑处理信息的速度与效率:超越计算机的直观判断能力 关键词: #人脑信息处理 Human Brain Information Processing #并行处理 Parallel Processing #视觉信息分析 Visual Information Analysis #决策速度 Decision Speed #计算机与人脑比较 Computer v…...
Spring Boot 中的 classpath详解
Spring Boot 中的 classpath 详解 在开发 Spring Boot 应用时,理解 classpath 的概念对于配置、资源管理以及构建项目非常重要。特别是当我们使用 Maven 打包工具时,项目的资源文件在不同的阶段会被放置到不同的目录。本文将深入探讨 Spring Boot 中的 …...
标准库以及HAL库——按键控制LED灯代码
按键控制LED本质还是控制GPIO,和点亮一个LED灯没什么区别 点亮一个LED灯:是直接控制输出引脚,GPIO初始化推挽输出即可 按键控制LED:是按键输入信号从而控制输出引脚,GPIO初始化推挽输出一个引脚以外还得加一个GPIO上拉输入 但是…...
Spring Cloud (四、服务熔断降级-HyStrix)
spring cloud 概述 分布式系统面临的问题 复杂分布式体系结构中的应用程序有数十个依赖关系,每个依赖关系在某些时候将不可避免地失败。 服务雪崩 多个微服务之间调用的时候,假设微服务A调用微服务B和微服务C,微服务B和微服务C又调用其它的…...
【C语言】如何插入并播放音频文件
在 C 语言中处理音频文件可以是一个有趣且挑战性的任务,尤其是在嵌入式开发或多媒体程序开发中。尽管 C 语言本身并不直接支持音频处理,但可以通过集成第三方库来处理音频文件的解码和播放。本篇博客将介绍如何在 C 语言中插入并播放音频文件,…...
图书项目:整合SSM
步骤: pom文件:导包,写入静态资源导出配置,连接数据库 建包:controller dao/mapper pojo service 配置文件:mybatis-config.xml applicationContext.xml(Spring的配置文件) datab…...
C#OPC(下)
安装 OPC UA SDK 通过 NuGet 包管理器,在 Visual Studio 中右键单击项目名称,选择 “管理 NuGet 程序包”,在搜索框中输入 “OPCFoundation.NetStandard.Opc.Ua”,找到对应的 OPC UA SDK 包后点击 “安装”,将其集成到…...
STLG_01_05_程序设计C语言 - 数据类型概念解析
一、典型例题 下面这些示例,将能够更熟练地运用C语言中的数据类型,加深对数据存储和处理的理解: 示例:确定变量a、b、c和d的数据类型,并说明它们的存储大小和取值范围 short int a -1000; unsigned int b 50000; f…...
使用工厂+策略模式实现去除繁琐的if else
使用工厂策略模式实现去除繁琐的if else 在中间有一个mapstruct的bug,即在修改实体类中的类型时,或者修改属性名字,mapstruct都无法进行转换,会报错,此时需要maven cleanmaven compile即可 前言 在这次的开发中&#…...
Apache MINA 反序列化漏洞CVE-2024-52046
漏洞描述: Apache MINA 是一个功能强大、灵活且高性能的网络应用框架。它通过抽象网络层的复杂性,提供了事件驱动架构和灵活的 Filter 链机制,使得开发者可以更容易地开发各种类型的网络应用。 Apache MINA 框架的 ObjectSerializationDeco…...
SpringSpringBoot常用注解总结
Spring&SpringBoot常用注解总结 1.SpringBootApplication 这个注解是 Spring Boot 项目的基石,创建 SpringBoot 项目之后会默认在主类加上。 SpringBootApplication public class SpringSecurityJwtGuideApplication {public static void main(java.lang.Str…...
设计模式 创建型 原型模式(Prototype Pattern)与 常见技术框架应用 解析
原型模式(Prototype Pattern)是一种创建型设计模式,其核心思想在于通过复制现有的对象(原型)来创建新的对象,而非通过传统的构造函数或类实例化方式。这种方式在需要快速创建大量相似对象时尤为高效&#x…...
cnPuTTY 0.82.0.1—PuTTY Release 0.82中文版本简单说明~~
2024-11-27 官方发布PuTTY 0.82主要包含如下变化: 1.Unicode处理进行了重大重构,以允许使用系统默认配置的字符集/代码页之外的Unicode字符。仅部分实现,其他尚未完成。 2.Unicode版本进行更新:所有字符分析均已更…...
TypeScript 常用类型
文章目录 1. 类型注解2. 原始类型3. 数组类型4. 联合类型5. 类型别名6. 函数类型7. 对象类型8. 接口类型8.1 接口声明8.2 接口继承 9. 元组类型10. 类型断言11. 字面量类型12. 枚举类型12.1 数字枚举12.2 字符串枚举 13. any 类型14. typeof 运算符 1. 类型注解 前言࿱…...
综合能源建模:理论、方法与实践
一、引言 随着全球能源需求的持续增长以及对能源安全、环境保护和可持续性发展的日益关注,综合能源系统(Integrated Energy System,IES)作为一种能够整合多种能源资源、实现能源高效利用和协同优化的解决方案,正逐渐成…...
《摄影艺术创作》慕课期末答案
《摄影艺术创作》慕课期末考试答案 题数 100 人们常说,“百闻不如一见”、“一图胜千言”,这强调的是 的表现力。 A视觉形象 B文字语言 C音响元素 D有声语言 “绘画是加法,摄影是减法”,主要是指无论摄影和绘画,都要…...
MySQL实用SQL示例
创建数据库 CREATE DATABASE zq-cloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;创建表 CREATE TABLE regulatory_firm_category (category_id int NOT NULL AUTO_INCREMENT COMMENT 分类id,自增主键,parent_id int NOT NULL COMMENT 父级id,category_…...
MySQL日志
MySQL日志 文章目录 MySQL日志binlogredoundoredo vs undo binlog binlog日志也就是二进制日志,把对于数据库的写入操作以二进制的形式保存到磁盘中。binlog日志是mysql的逻辑日志,可以理解为记录的是sql日志,由mysql的服务层进行记录&#…...
双目的一些文章学习
文章1 PSMNet https://arxiv.org/pdf/1803.08669PSMNet文章博客PSMNet文章中牵涉到的一些知识,空洞卷积,SPPNet网络,计算视差时用soft argmin代替argmin文章中引入了空洞卷积和SPPNet网络来融合多尺度的信息,又引入3D卷积来增加模…...
国产文本编辑器EverEdit - 批量转码转换行符
1 批量转码&转换行符 1.1 应用场景 如果用户批量在Windows编辑文件,要上传到异构系统,如:Linux,则需要批量转换编码和换行符,此时可以使用EverEdit的批量转码功能。 1.2 使用方法 选择主菜单文档 -> 批量转码…...
NextCloud服务安装与配置教程
NextCloud服务安装与配置教程 什么是 NextCloud: Nextcloud 是一款开源的私有云存储和协作平台,允许用户在自己的服务器上托管数据并管理团队协作。它可以作为一个功能丰富、安全可靠的替代方案,与商业云服务(如 Google Drive、Dropbox)相比提供更多控制和隐私保护。简单来…...