mycat實現mysql基於GITD實現雙主雙從讀寫分離master節點高可用

来源:https://www.cnblogs.com/yeyouqing/archive/2023/05/24/17426909.html
-Advertisement-
Play Games

架構說明 10.0.0.18 master節點和10.0.0.22節點互為主 10.0.0.19 10.0.0.18的slave節點 10.0.0.22 master節點和10.0.0.19節點互為主 10.0.0.24 10.0.0.22的slave節點 10.0.0.23 mycat節點 mys ...


架構說明

10.0.0.18 master節點和10.0.0.22節點互為主
10.0.0.19 10.0.0.18的slave節點
10.0.0.22 master節點和10.0.0.19節點互為主
10.0.0.24 10.0.0.22的slave節點
10.0.0.23 mycat節點
mysql版本8.0.32
系統版本:rocky8.4

mysql主從搭建

#搭建雙主節點
#搭建第一個主10.0.0.18
#註釋掉/etc/my.cnf.d/mysql-server.cnf
cat >/etc/my.cnf.d/mysql-server.cnf<<'EOF'
#
# This group are read by MySQL server.
# Use it for options that only the server (but not clients) should see
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/en/server-configuration-defaults.html

# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
#log-error=/var/log/mysql/mysqld.log
#pid-file=/run/mysqld/mysqld.pid
#log-bin=/data/mysql/logbin/mysql-bin
EOF

#配置主節點的my.cat配置
cat >/etc/my.cnf<<'EOF'
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysql/mysqld.log
pid-file=/run/mysqld/mysqld.pid
server-id=18
#read-only
general_log
gtid_mode=ON
enforce_gtid_consistency
log-bin=/data/mysql/logbin/mysql-bin
EOF

#創建存放二進位日誌的目錄
mkdir -p /data/mysql/logbin/
chown -R mysql.mysql /data

#啟動資料庫
systemctl enable --now mysqld

#配置賬號和授權
mysql
create user 'repluser'@'10.0.0.%' identified by '123456';
grant replication slave on *.* to 'repluser'@'10.0.0.%';
#創建mycat使用的賬號
create user 'wbiao'@'10.0.0.%' IDENTIFIED BY '123456';
grant ALL ON hellodb.* TO 'wbiao'@'10.0.0.%';

#搭建第二個主10.0.0.22
#註釋掉/etc/my.cnf.d/mysql-server.cnf
cat >/etc/my.cnf.d/mysql-server.cnf<<'EOF'
#
# This group are read by MySQL server.
# Use it for options that only the server (but not clients) should see
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/en/server-configuration-defaults.html

# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
#log-error=/var/log/mysql/mysqld.log
#pid-file=/run/mysqld/mysqld.pid
#log-bin=/data/mysql/logbin/mysql-bin
EOF

#配置主節點的my.cat配置
cat >/etc/my.cnf<<'EOF'
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysql/mysqld.log
pid-file=/run/mysqld/mysqld.pid
server-id=22
#read-only
general_log
gtid_mode=ON
enforce_gtid_consistency
log-bin=/data/mysql/logbin/mysql-bin
EOF

#創建存放二進位日誌的目錄
mkdir -p /data/mysql/logbin/
chown -R mysql.mysql /data

#啟動資料庫
systemctl enable --now mysqld

#10.0.0.22指向10.0.0.18
執行change master to
CHANGE MASTER TO
MASTER_HOST='10.0.0.18',
MASTER_USER='repluser',
MASTER_PASSWORD='123456',
MASTER_PORT=3306,
MASTER_AUTO_POSITION=1;
#開啟IO線程和SQL線程
start slave;
#檢查狀態
show slave status\G
#檢查
mysql> select user,host from mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| repluser         | 10.0.0.%  |
| wbiao            | 10.0.0.%  |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
6 rows in set (0.00 sec)


10.0.0.18指向10.0.0.22
執行change master to
CHANGE MASTER TO
MASTER_HOST='10.0.0.22',
MASTER_USER='repluser',
MASTER_PASSWORD='123456',
MASTER_PORT=3306,
MASTER_AUTO_POSITION=1;
#開啟IO線程和SQL線程
start slave;
#檢查狀態
show slave status\G

#配置10.0.0.18的從節點10.0.0.19
#註釋掉/etc/my.cnf.d/mysql-server.cnf
cat >/etc/my.cnf.d/mysql-server.cnf<<'EOF'
#
# This group are read by MySQL server.
# Use it for options that only the server (but not clients) should see
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/en/server-configuration-defaults.html

# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
#log-error=/var/log/mysql/mysqld.log
#pid-file=/run/mysqld/mysqld.pid
#log-bin=/data/mysql/logbin/mysql-bin
EOF
#配置從節點10.0.0.19的my.cat配置
cat >/etc/my.cnf<<'EOF'
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysql/mysqld.log
pid-file=/run/mysqld/mysqld.pid
server-id=19
read-only
general_log
gtid_mode=ON
enforce_gtid_consistency
log-bin=/data/mysql/logbin/mysql-bin
EOF

#創建存放二進位日誌的目錄
mkdir -p /data/mysql/logbin/
chown -R mysql.mysql /data
#啟動資料庫
systemctl enable --now mysqld

#從節點10.0.0.19執行change master to
CHANGE MASTER TO
MASTER_HOST='10.0.0.18',
MASTER_USER='repluser',
MASTER_PASSWORD='123456',
MASTER_PORT=3306,
MASTER_AUTO_POSITION=1;
#開啟IO線程和SQL線程
start slave;
#檢查狀態
show slave status\G


##配置10.0.0.22的從節點10.0.0.24
#註釋掉/etc/my.cnf.d/mysql-server.cnf
cat >/etc/my.cnf.d/mysql-server.cnf<<'EOF'
#
# This group are read by MySQL server.
# Use it for options that only the server (but not clients) should see
#
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/en/server-configuration-defaults.html

# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd

#[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
#log-error=/var/log/mysql/mysqld.log
#pid-file=/run/mysqld/mysqld.pid
#log-bin=/data/mysql/logbin/mysql-bin
EOF
#配置從節點10.0.0.24的my.cat配置
cat >/etc/my.cnf<<'EOF'
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysql/mysqld.log
pid-file=/run/mysqld/mysqld.pid
server-id=24
read-only
general_log
gtid_mode=ON
enforce_gtid_consistency
log-bin=/data/mysql/logbin/mysql-bin
EOF

#創建存放二進位日誌的目錄
mkdir -p /data/mysql/logbin/
chown -R mysql.mysql /data
#啟動資料庫
systemctl enable --now mysqld

#從節點10.0.0.24執行change master to
CHANGE MASTER TO
MASTER_HOST='10.0.0.22',
MASTER_USER='repluser',
MASTER_PASSWORD='123456',
MASTER_PORT=3306,
MASTER_AUTO_POSITION=1;
#開啟IO線程和SQL線程
start slave;
#檢查狀態
show slave status\G

#10.0.0.18導入hellodb的資料庫
[root@10 ~]# mysql <hellodb_innodb.sql
##檢查狀態
show slave status\G
#所有節點檢查數據
select * from hellodb.students;
#雙主只能對一個主進行寫操作

 mycat搭建10.0.0.23

#安裝java環境
yum -y install java
#創建安裝目錄和解壓
mkdir -p /apps
tar -xf Mycat-server-1.6.7.6-release-20210303094759-linux.tar.gz -C /app
#配置環境變數
[root@10 ~]# echo 'PATH=/apps/mycat/bin:$PATH' > /etc/profile.d/mycat.sh
[root@10 ~]# . /etc/profile.d/mycat.sh
[root@10 ~]# echo $PATH
/apps/mycat/bin:/usr/share/Modules/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

#配置mycat實現讀寫分離主從高可用
#修改schema.xml的配置文件
#balance="2",所有讀操作都隨機的在writeHost、readhost上分發。
#balance="1",全部的readHost與stand by writeHost參與select語句的負載均衡,簡單的說,當雙主雙從模式(M1->S1,M2->S2,並且M1與M2互為主備)
#writeType屬性負載均衡類型,目前的取值有3種:
#1.writeType="0", 所有寫操作發送到配置的第一個writeHost,第一個掛了切到還生存的第二個writeHost,重新啟動後已切換後的為準,切換記錄在配置文件中:dnindex.properties.
#2.writeType="1",所有寫操作都隨機的發送到配置的writeHost,1.5以後廢棄不推薦。
#3.writeType="2",不執行寫操作
[root@10 conf]# cat schema.xml
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
    <schema name="wbiao" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1">
    </schema>
    <dataNode name="dn1" dataHost="localhost1" database="hellodb" />
    <dataHost name="localhost1" maxCon="1000" minCon="10" balance="1"
              writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">
        <heartbeat>select user()</heartbeat>
        <writeHost host="host1" url="10.0.0.18:3306" user="wbiao" password="123456">
         <readHost host="host2" url="10.0.0.19:3306" user="wbiao" password="123456" />
        </writeHost>
    <writeHost host="host3" url="10.0.0.22:3306" user="wbiao" password="123456">
         <readHost host="host4" url="10.0.0.23:3306" user="wbiao" password="123456" />
        </writeHost>
    </dataHost>
</mycat:schema>


#server.xml配置文件
[root@10 conf]# cat server.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- - - Licensed under the Apache License, Version 2.0 (the "License"); 
    - you may not use this file except in compliance with the License. - You 
    may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 
    - - Unless required by applicable law or agreed to in writing, software - 
    distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT 
    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the 
    License for the specific language governing permissions and - limitations 
    under the License. -->
<!DOCTYPE mycat:server SYSTEM "server.dtd">
<mycat:server xmlns:mycat="http://io.mycat/">
    <system>
    <property name="nonePasswordLogin">0</property> <!-- 0為需要密碼登陸、1為不需要密碼登陸 ,預設為0,設置為1則需要指定預設賬戶-->
    <property name="ignoreUnknownCommand">0</property><!-- 0遇上沒有實現的報文(Unknown command:),就會報錯、1為忽略該報文,返回ok報文。
    在某些mysql客戶端存在客戶端已經登錄的時候還會繼續發送登錄報文,mycat會報錯,該設置可以繞過這個錯誤-->
    <property name="useHandshakeV10">1</property>
    <property name="removeGraveAccent">1</property>
    <property name="useSqlStat">0</property>  <!-- 1為開啟實時統計、0為關閉 -->
    <property name="useGlobleTableCheck">0</property>  <!-- 1為開啟全加班一致性檢測、0為關閉 -->
    <property name="sqlExecuteTimeout">300</property>  <!-- SQL 執行超時 單位:秒-->
        <property name="sequenceHandlerType">1</property>
    <!--<property name="sequnceHandlerPattern">(?:(\s*next\s+value\s+for\s*MYCATSEQ_(\w+))(,|\)|\s)*)+</property>
    INSERT INTO `travelrecord` (`id`,user_id) VALUES ('next value for MYCATSEQ_GLOBAL',"xxx");
    -->
    <!--必須帶有MYCATSEQ_或者 mycatseq_進入序列匹配流程 註意MYCATSEQ_有空格的情況-->
    <property name="sequnceHandlerPattern">(?:(\s*next\s+value\s+for\s*MYCATSEQ_(\w+))(,|\)|\s)*)+</property>
    <property name="subqueryRelationshipCheck">false</property> <!-- 子查詢中存在關聯查詢的情況下,檢查關聯欄位中是否有分片欄位 .預設 false -->
    <property name="sequenceHanlderClass">io.mycat.route.sequence.handler.HttpIncrSequenceHandler</property>
      <!--  <property name="useCompression">1</property>--> <!--1為開啟mysql壓縮協議-->
        <!--  <property name="fakeMySQLVersion">5.6.20</property>--> <!--設置模擬的MySQL版本號-->
    <!-- <property name="processorBufferChunk">40960</property> -->
    <!-- 
    <property name="processors">1</property> 
    <property name="processorExecutor">32</property> 
     -->
        <!--預設為type 0: DirectByteBufferPool | type 1 ByteBufferArena | type 2 NettyBufferPool -->
        <property name="processorBufferPoolType">0</property>
        <property name="serverPort">3306</property>
        <!--預設是65535 64K 用於sql解析時最大文本長度 -->
        <!--<property name="maxStringLiteralLength">65535</property>-->
        <!--<property name="sequenceHandlerType">0</property>-->
        <!--<property name="backSocketNoDelay">1</property>-->
        <!--<property name="frontSocketNoDelay">1</property>-->
        <!--<property name="processorExecutor">16</property>-->
        <!--
            <property name="serverPort">8066</property>
            <property name="managerPort">9066</property>
            <property name="idleTimeout">300000</property>
            <property name="authTimeout">15000</property>
            <property name="bindIp">0.0.0.0</property>
            <property name="dataNodeIdleCheckPeriod">300000</property> 5 * 60 * 1000L; //連接空閑檢查
            <property name="frontWriteQueueSize">4096</property> <property name="processors">32</property> -->
        <!--分散式事務開關,0為不過濾分散式事務,1為過濾分散式事務(如果分散式事務內只涉及全局表,則不過濾),2為不過濾分散式事務,但是記錄分散式事務日誌-->
        <property name="handleDistributedTransactions">0</property>
        
            <!--
            off heap for merge/order/group/limit      1開啟   0關閉
        -->
        <property name="useOffHeapForMerge">0</property>

        <!--
            單位為m
        -->
        <property name="memoryPageSize">64k</property>

        <!--
            單位為k
        -->
        <property name="spillsFileBufferSize">1k</property>

        <property name="useStreamOutput">0</property>

        <!--
            單位為m
        -->
        <property name="systemReserveMemorySize">384m</property>


        <!--是否採用zookeeper協調切換  -->
        <property name="useZKSwitch">false</property>

        <!-- XA Recovery Log日誌路徑 -->
        <!--<property name="XARecoveryLogBaseDir">./</property>-->

        <!-- XA Recovery Log日誌名稱 -->
        <!--<property name="XARecoveryLogBaseName">tmlog</property>-->
        <!--如果為 true的話 嚴格遵守隔離級別,不會在僅僅只有select語句的時候在事務中切換連接-->
        <property name="strictTxIsolation">false</property>
        <!--如果為0的話,涉及多個DataNode的catlet任務不會跨線程執行-->
        <property name="parallExecute">0</property>
        <property name="serverBacklog">2048</property>
    </system>
    
    <!-- 全局SQL防火牆設置 -->
    <!--白名單可以使用通配符%或著*-->
    <!--例如<host host="127.0.0.*" user="root"/>-->
    <!--例如<host host="127.0.*" user="root"/>-->
    <!--例如<host host="127.*" user="root"/>-->
    <!--例如<host host="1*7.*" user="root"/>-->
    <!--這些配置情況下對於127.0.0.1都能以root賬戶登錄-->
    <!--
    <firewall>
       <whitehost>
          <host host="1*7.0.0.*" user="root"/>
       </whitehost>
       <blacklist check="false">
       </blacklist>
    </firewall>
    -->

    <user name="root" defaultAccount="true">
        <property name="password">qwe123</property>
        <property name="schemas">wbiao</property>
        <property name="defaultSchema">wbiao</property>
        <!--No MyCAT Database selected 錯誤前會嘗試使用該schema作為schema,不設置則為null,報錯 -->
        
        <!-- 表級 DML 許可權設置 -->
        <!--         
        <privileges check="false">
            <schema name="wbiao" dml="0110" >
                <table name="tb01" dml="0000"></table>
                <table name="tb02" dml="1111"></table>
            </schema>
        </privileges>        
         -->
    </user>

    <user name="user">
        <property name="password">user</property>
        <property name="schemas">wbiao</property>
        <property name="readOnly">true</property>
        <property name="defaultSchema">wbiao</property>
    </user>

</mycat:server>


#啟動mycat
[root@10 conf]# mycat start
Starting Mycat-server...
監控日誌
[root@10 ~]# tail -F /apps/mycat/logs/wrapper.log
STATUS | wrapper  | 2023/05/24 02:44:41 | <-- Wrapper Stopped
STATUS | wrapper  | 2023/05/24 02:44:45 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2023/05/24 02:44:45 | Launching a JVM...
INFO   | jvm 1    | 2023/05/24 02:44:46 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO   | jvm 1    | 2023/05/24 02:44:46 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
INFO   | jvm 1    | 2023/05/24 02:44:46 | 
INFO   | jvm 1    | 2023/05/24 02:44:48 | MyCAT Server startup successfully. see logs in logs/mycat.log

#鏈接測試
[root@10 conf]# mysql -uroot -pqwe123 -h10.0.0.23
#讀測試
mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| 10.0.0.24  |
+------------+
1 row in set (0.08 sec)

mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| 10.0.0.22  |
+------------+
1 row in set (0.00 sec)

mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| 10.0.0.19  |
+------------+
1 row in set (0.01 sec)

mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| 10.0.0.19  |
+------------+
1 row in set (0.01 sec)

mysql> select @@hostname;
+------------+
| @@hostname |
+------------+
| 10.0.0.24  |
+------------+
1 row in set (0.01 sec

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 在之前較早隨筆中介紹過實現多行表頭的處理,通過手工創建欄位以及映射數據源欄位屬性的方式實現,有些客戶反映是否可以通過代碼方式更方便的創建對應的處理操作,因此本篇隨筆繼續探討這個多行表頭的處理的操作,使用代碼的方式結合擴展函數處理,快速的實現GridControl的多行表頭的處理操作。 ...
  • >依賴註入實現了系統之間、模塊之間和對象之間依賴關係的解耦,基本上是現代應用程式框架必不可少的一個組成部分。 > >ABP的依賴註入系統是基於Microsoft的依賴註入擴展庫(Microsoft.Extensions.DependencyInjection),所以能夠完全相容.net Core中的 ...
  • 目錄 一、yum安裝 二、yum安裝分類 三、yum命令 四、實驗 一、yum安裝 yum:1.基於rpm升級,彌補rpm只能一個一個安裝依賴文件 2.yum可以自動安裝依賴文件。 3.從倉庫中下載包 centos8:使用yum或者dhf(兩種命令格式基本一致,文件格式.rpm) ubuntu:使用 ...
  • 目錄 一、nfs服務 二、nfs優點 三、配置文件 四、共用文件配置過程 五、實驗 1.創建共用文件(兩台終端共用) 一、nfs服務 概念:網路上共用文件系統的協議,運行多個伺服器之間通過網路共用文件和目錄 服務端:將指定目錄標記為共用目錄,服務段有訪問許可權,共用目錄有全部許可權 客戶端:通過nfs協 ...
  • SPI單線半雙工數據收發應用筆記 SPI 介面可以工作在單線半雙工模式,即主設備使用 MOSI 引腳,從設備使用 MISO 引腳進行通訊。CH32V203C8T6 晶元內置兩路 SPI,使用 SPI1 作為主機,SPI2 作為從機,配合 DMA 完成 SPI 介面的單線半雙工通信測試。 查閱應用手冊 ...
  • 目錄 一、ssh概念 二、配置文件 三、ssh組成結構 四、遠程式控制制過程 五、遠程複製 六、配置密鑰 七、wraooers防火牆 一、ssh概念 ssh:一種安全通道協議 功能:1.實現字元界面遠程登錄 2.遠程複製 3.ssh協議是對通信對方的數據傳輸進行加密出來,包括用戶口令(安全性) 4.客戶 ...
  • 目錄 一、文本傳輸協議 二、連接方式 三、程式安裝 四、黑名單和白名單 五、實驗 1.實驗一:匿名用戶下載與上傳 2.實驗二:關閉匿名用戶登錄,允許普通用戶登錄在家目錄上傳和下載 3.實驗三:禁止用戶切換目錄,只能在家目錄操作 4.實驗四:黑名單限制test1登錄 5.實驗五:白名單限制 6.實驗六 ...
  • 常用配置路徑代理映射 http和https 配置nginx路徑下的配置文件:/etc/nginx/conf.d/nginx.conf (每個人的可能不一樣,但是我這個就是yum 直接安裝的) 如下配置 配置http 和 https 、ws 和 wss #自定義配置地址upstream halo { ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...