Mysql資料庫 | 基於Docker搭建Mysql-8.0以上版本主從實例實戰

来源:https://www.cnblogs.com/mazhilin/archive/2022/04/08/16116905.html
-Advertisement-
Play Games

Mysql主從環境概述 Mysql集群主從環境搭建 本次採用Docker部署集群,並且首先主從實例配置。 1.Mysql-Cluster集群服務規劃 2.Mysql-Cluster集群先決條件 創建 Mysql-Cluster集群主要配置目錄如下: 2.1 Mysql-Master節點[3308] ...


Mysql主從環境概述

Mysql集群主從環境搭建

本次採用Docker部署集群,並且首先主從實例配置。

1.Mysql-Cluster集群服務規劃

2.Mysql-Cluster集群先決條件

創建 Mysql-Cluster集群主要配置目錄如下:
Mysql-Cluster集群

2.1 Mysql-Master節點[3308]

創建 Mysql-Slave節點主要配置文件目錄以及配置文件如下:

Mysql-Master節點

[1].mysql.cnf配置文件:

# Copyright (c) 2015, 2021, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# 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, version 2.0, 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  Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]
skip-grant-tables
skip-host-cache
skip-name-resolve
default_authentication_plugin=mysql_native_password
bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
open_files_limit = 3072
back_log=200
max_connections = 20
max_connect_errors = 10
table_open_cache = 128
external-locking = FALSE
max_allowed_packet = 4M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 128
tmp_table_size = 16M
max_heap_table_size = 8M
slow_query_log = 1
long_query_time = 0.05
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M
key_buffer_size = 8M
read_buffer_size = 1M
read_rnd_buffer_size = 8M
bulk_insert_buffer_size = 32M
default-storage-engine=InnoDB
log-bin=mysql-bin
binlog_format=row
server-id = 1
transaction_isolation = REPEATABLE-READ
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
default-storage-engine=INNODB
innodb_thread_concurrency=12
innodb_flush_log_at_trx_commit=1
innodb_max_dirty_pages_pct=30
innodb_io_capacity=10000
innodb_log_buffer_size=1024M
innodb_flush_method=O_DIRECT
innodb_flush_neighbors=0
innodb_log_files_in_group=4
innodb_compression_level=0
innodb_file_per_table=1
innodb_compression_pad_pct_max=50
innodb_buffer_pool_size=256M
interactive_timeout=500
wait_timeout=500
innodb_log_file_size=256M
lower_case_table_names=1
lower_case_file_system=ON
replicate-ignore-db=mysql
replicate-ignore-db=sys
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
[mysqld]
default_authentication_plugin=mysql_native_password
bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0
skip-grant-tables
skip-host-cache
skip-name-resolve
skip-grant-tables
init_connect='SET NAMES utf8mb4'
open_files_limit = 3072
back_log=200
max_connections = 20
max_connect_errors = 10
table_open_cache = 128
external-locking = FALSE
max_allowed_packet = 4M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 128
tmp_table_size = 16M
max_heap_table_size = 8M
slow_query_log = 1
long_query_time = 0.05
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M
key_buffer_size = 8M
read_buffer_size = 1M
read_rnd_buffer_size = 8M
bulk_insert_buffer_size = 32M
default-storage-engine=InnoDB
log-bin=mysql-bin
binlog_format=row
server-id = 1
transaction_isolation = REPEATABLE-READ
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
default-storage-engine=INNODB
innodb_thread_concurrency=12
innodb_flush_log_at_trx_commit=1
innodb_max_dirty_pages_pct=30
innodb_io_capacity=10000
innodb_log_buffer_size=1024M
innodb_flush_method=O_DIRECT
innodb_flush_neighbors=0
innodb_log_files_in_group=4
innodb_compression_level=0
innodb_file_per_table=1
innodb_compression_pad_pct_max=50
innodb_buffer_pool_size=256M
interactive_timeout=500
wait_timeout=500
innodb_log_file_size=256M
lower_case_table_names=1
lower_case_file_system=ON
replicate-ignore-db=mysql
replicate-ignore-db=sys
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
[mysqldump]
quick
quote-names
max_allowed_packet=500M
[client]
default-character-set=utf8mb4
2.2 Mysql-Slave節點[3309]

創建 Mysql-Slave節點主要配置文件目錄以及配置文件如下:
Mysql-Slave

[1].mysql.cnf配置文件:

 # Copyright (c) 2015, 2021, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation.  The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# 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, version 2.0, 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  Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]
skip-grant-tables
skip-host-cache
skip-name-resolve
default_authentication_plugin=mysql_native_password
bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
open_files_limit = 3072
back_log=200
max_connections = 20
max_connect_errors = 10
table_open_cache = 128
external-locking = FALSE
max_allowed_packet = 4M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 128
tmp_table_size = 16M
max_heap_table_size = 8M
slow_query_log = 1
long_query_time = 0.05
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M
key_buffer_size = 8M
read_buffer_size = 1M
read_rnd_buffer_size = 8M
bulk_insert_buffer_size = 32M
default-storage-engine=InnoDB
log-bin=mysql-bin
binlog_format=row
server-id = 2
relay-log = mysql-relay
transaction_isolation = REPEATABLE-READ
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
default-storage-engine=INNODB
innodb_thread_concurrency=12
innodb_flush_log_at_trx_commit=1
innodb_max_dirty_pages_pct=30
innodb_io_capacity=10000
innodb_log_buffer_size=1024M
innodb_flush_method=O_DIRECT
innodb_flush_neighbors=0
innodb_log_files_in_group=4
innodb_compression_level=0
innodb_file_per_table=1
innodb_compression_pad_pct_max=50
innodb_buffer_pool_size=256M
interactive_timeout=500
wait_timeout=500
innodb_log_file_size=256M
lower_case_table_names=1
lower_case_file_system=ON
replicate-ignore-db=mysql
replicate-ignore-db=sys
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
[mysqld]
default_authentication_plugin=mysql_native_password
bind-address = 0.0.0.0
mysqlx-bind-address = 0.0.0.0
skip-grant-tables
skip-host-cache
skip-name-resolve
skip-grant-tables
init_connect='SET NAMES utf8mb4'
open_files_limit = 3072
back_log=200
max_connections = 20
max_connect_errors = 10
table_open_cache = 128
external-locking = FALSE
max_allowed_packet = 4M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 128
tmp_table_size = 16M
max_heap_table_size = 8M
slow_query_log = 1
long_query_time = 0.05
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M
key_buffer_size = 8M
read_buffer_size = 1M
read_rnd_buffer_size = 8M
bulk_insert_buffer_size = 32M
default-storage-engine=InnoDB
log-bin=mysql-bin
binlog_format=row
server-id = 2
relay-log = mysql-relay
transaction_isolation = REPEATABLE-READ
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
default-storage-engine=INNODB
innodb_thread_concurrency=12
innodb_flush_log_at_trx_commit=1
innodb_max_dirty_pages_pct=30
innodb_io_capacity=10000
innodb_log_buffer_size=1024M
innodb_flush_method=O_DIRECT
innodb_flush_neighbors=0
innodb_log_files_in_group=4
innodb_compression_level=0
innodb_file_per_table=1
innodb_compression_pad_pct_max=50
innodb_buffer_pool_size=256M
interactive_timeout=500
wait_timeout=500
innodb_log_file_size=256M
lower_case_table_names=1
lower_case_file_system=ON
replicate-ignore-db=mysql
replicate-ignore-db=sys
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
[mysqldump]
quick
quote-names
max_allowed_packet=500M
[client]
default-character-set=utf8mb4
3.Mysql-Cluster集群Docker部署腳本
3.1 Mysql-Master節點[3308]
docker run -itd -p 3308:3306 --restart always  --privileged=true --name mysql-master --network-alias mysql-master  --hostname mysql-master -v /docker/mysql-cluster/master/conf/my.cnf:/etc/mysql/my.cnf -v /docker/mysql-cluster/master/conf/conf.d/:/etc/mysql/conf/conf.d/ -v /docker/mysql-cluster/master/data:/var/lib/mysql  -e "JAVA_OPTS=-server -Xms512m -Xmx512m -Xmn256m -Duser.home=/opt -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:+AlwaysPreTouch -XX:-UseBiasedLocking" -e TZ="Asia/Shanghai" -e MYSQL_ROOT_PASSWORD=PivotalCloud999@Love  mysql:latest
3.2 Mysql-Slave節點[3309]
docker run -itd -p 3309:3306 --restart always  --privileged=true --name mysql-slave --network-alias mysql-slave  --hostname mysql-slave -v /docker/mysql-cluster/slave/conf/my.cnf:/etc/mysql/my.cnf -v /docker/mysql-cluster/slave/conf/conf.d/:/etc/mysql/conf/conf.d/ -v /docker/mysql-cluster/slave/data:/var/lib/mysql  -e "JAVA_OPTS=-server -Xms512m -Xmx512m -Xmn256m -Duser.home=/opt -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:+AlwaysPreTouch -XX:-UseBiasedLocking" -e TZ="Asia/Shanghai" -e MYSQL_ROOT_PASSWORD=PivotalCloud999@Love  mysql:latest
4.Mysql-Cluster集群Docker執行部署
4.1 Mysql-Master節點[3308]
Marklin:~ marklin$ docker run -itd -p 3308:3306 --restart always  --privileged=true --name mysql-master --network-alias mysql-master  --hostname mysql-master -v /docker/mysql-cluster/master/conf/my.cnf:/etc/mysql/my.cnf -v /docker/mysql-cluster/master/conf/conf.d/:/etc/mysql/conf/conf.d/ -v /docker/mysql-cluster/master/data:/var/lib/mysql  -e "JAVA_OPTS=-server -Xms512m -Xmx512m -Xmn256m -Duser.home=/opt -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:+AlwaysPreTouch -XX:-UseBiasedLocking" -e TZ="Asia/Shanghai" -e MYSQL_ROOT_PASSWORD=PivotalCloud999@Love  mysql:latest
d99ac84d4e11dd3835b89ff410a488c8041c43ec67aa4bccb1679edf57b08539
Marklin:~ marklin$
4.2 Mysql-Slave節點[3309]
Marklin:~ marklin$ docker run -itd -p 3309:3306 --restart always  --privileged=true --name mysql-slave --network-alias mysql-slave  --hostname mysql-slave -v /docker/mysql-cluster/slave/conf/my.cnf:/etc/mysql/my.cnf -v /docker/mysql-cluster/slave/conf/conf.d/:/etc/mysql/conf/conf.d/ -v /docker/mysql-cluster/slave/data:/var/lib/mysql  -e "JAVA_OPTS=-server -Xms512m -Xmx512m -Xmn256m -Duser.home=/opt -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:+AlwaysPreTouch -XX:-UseBiasedLocking" -e TZ="Asia/Shanghai" -e MYSQL_ROOT_PASSWORD=PivotalCloud999@Love  mysql:latest
fe3eb3b02fc0cf9e187a8158b58bb5832d70a4462b583d4ba4cf4297ff7dd8d3
Marklin:~ marklin$
4.3 Mysql-Cluster集群部署以及測試結果:

Mysql-Cluster集群部署:

Mysql-Cluster集群

測試Navicat客戶端連接數據如下:

Navicat客戶端

5.Mysql-Cluster集群主從節點後續配置
5.1 Mysql-Cluster集群節點IP地址

1.mysql-master節點IPAddress: docker inspect --format='{{.NetworkSettings.IPAddress}}' mysql-master

Marklin:~ marklin$ docker inspect --format='{{.NetworkSettings.IPAddress}}' mysql-master
172.17.0.13
Marklin:~ marklin$

2.查看mysql-slave節點的IPAddress: docker inspect --format='{{.NetworkSettings.IPAddress}}' mysql-slave

Marklin:~ marklin$ docker inspect --format='{{.NetworkSettings.IPAddress}}' mysql-slave
172.17.0.14
Marklin:~ marklin$
5.2 Mysql-Cluster集群主從用戶授權配置

進入Docker後臺的兩種方式:
1.通過終端輸入docker ps查看容器進程,最後執行docker exec -it mysql容器名稱/id bash
執行docker ps:

Marklin:~ marklin$ docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED        STATUS         PORTS                                                                                              NAMES
fe3eb3b02fc0   mysql:latest                               "docker-entrypoint.s…"   18 hours ago   Up 2 hours     33060/tcp, 0.0.0.0:3309->3306/tcp                                                                  mysql-slave
d99ac84d4e11   mysql:latest                               "docker-entrypoint.s…"   18 hours ago   Up 2 hours     33060/tcp, 0.0.0.0:3308->3306/tcp                                                                  mysql-master
59030d0bff07   docker/dev-environments-default:stable-1   "sleep infinity"         19 hours ago   Up 4 minutes                                                                                                      mysql-cluster
d0f4142d8781   dubbo-admin:latest                         "tini -- /usr/local/…"   13 days ago    Up 2 hours     0.0.0.0:8082->8080/tcp                                                                             dubbo-monitor
c91f1bd81cf9   nacos-server:latest                        "bin/docker-startup.…"   13 days ago    Up 2 hours     0.0.0.0:8848->8848/tcp                                                                             nacos-server
fefa57c84ee1   dubbo-admin:latest                         "tini -- /usr/local/…"   13 days ago    Up 2 hours     0.0.0.0:8080->8080/tcp                                                                             dubbo-server
f3b3f54acfc3   zookeeper:latest                           "/docker-entrypoint.…"   13 days ago    Up 2 hours     0.0.0.0:2181->2181/tcp, 0.0.0.0:2888->2888/tcp, 0.0.0.0:3888->3888/tcp, 8080/tcp                   zookeeper-server
1f323ef0299f   mysql:5.7.36                               "docker-entrypoint.s…"   5 weeks ago    Up 2 hours     33060/tcp, 0.0.0.0:3307->3306/tcp                                                                  mysql5.7-server
a53b9713927f   rabbitmq:latest                            "docker-entrypoint.s…"   5 weeks ago    Up 2 hours     0.0.0.0:5671-5672->5671-5672/tcp, 4369/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp   rabbitmq-server
bd7637c345b6   mysql:8.0.21                               "docker-entrypoint.s…"   5 weeks ago    Up 2 hours     0.0.0.0:3306->3306/tcp, 33060/tcp                                                                  mysql-server
87aa352ecead   redis:latest                               "docker-entrypoint.s…"   5 weeks ago    Up 2 hours     0.0.0.0:6379->6379/tcp                                                                             redis-server
6af30979d57c   minio:latest                               "/usr/bin/docker-ent…"   5 weeks ago    Up 2 hours     0.0.0.0:8081->8081/tcp, 0.0.0.0:9000->9000/tcp                                                     minio-server
51ffd8d090ba   portainer-ce:latest                        "/portainer"             5 weeks ago    Up 2 hours     8000/tcp, 9443/tcp, 0.0.0.0:9999->9000/tcp                                                         portainer-server
Marklin:~ marklin$ 

進入mysql容器: docker exec -it d99ac84d4e11 bash

Marklin:~ marklin$ docker exec -it d99ac84d4e11 bash
root@mysql-master:/#

2.通過Docker可視化後臺進入:
點擊Consle:

點擊Conect:

進入到mysql容器:

登錄mysql客戶端:mysql -u root -p

root@mysql-master:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.27 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

如圖所示:

創建用戶並授權:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'PivotalCloud999@Love';
Query OK, 0 rows affected (0.10 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'PivotalCloud999@Love';
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE USER 'slave'@'%' IDENTIFIED WITH mysql_native_password BY 'PivotalCloud999@Love';
Query OK, 0 rows affected (0.06 sec)

mysql> GRANT REPLICATION SLAVE ON *.* TO 'slave'@'%';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql>

如圖所示:

查看master狀態:show master status; ,記錄二進位文件名和位置

mysql> show variables like '%server%';
+---------------------------------+--------------------------------------+
| Variable_name                   | Value                                |
+---------------------------------+--------------------------------------+
| character_set_server            | utf8mb4                              |
| collation_server                | utf8mb4_0900_ai_ci                   |
| immediate_server_version        | 999999                               |
| innodb_dedicated_server         | OFF                                  |
| innodb_ft_server_stopword_table |                                      |
| original_server_version         | 999999                               |
| server_id                       | 1                                    |
| server_id_bits                  | 32                                   |
| server_uuid                     | 9a675ceb-64d5-11ec-b628-0242ac11000d |
+---------------------------------+--------------------------------------+
9 rows in set (0.00 sec)

mysql> show master status;
+---------------+----------+--------------+------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000003 |     1400 |              |                  |                   |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

mysql>

如圖所示:

版權聲明:本文為博主原創文章,遵循相關版權協議,如若轉載或者分享請附上原文出處鏈接和鏈接來源。


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

-Advertisement-
Play Games
更多相關文章
  • 在鴻蒙開發中tab切換功能(如下圖所示)是非常常見一個功能,今天描述如下功能怎麼實現?開發中需要準備哪些資料? 今天我們從“資料準備”,“Tabs功能實現”,“底部按鈕功能實現”,“運行效果”四個方面進行描述 1. 開發準備 1.1 資料準備 想要實現如上圖功能的話,需要學習“Tabs”,“TabC ...
  • 背景 開發者在應用中集成HMS Core部分服務時,android sdk 以及flutter等跨平臺sdk,會出現編譯打包後,運行報6003錯誤碼的情況。根據查詢可以得知,錯誤代碼 6003 表示證書指紋配置不一致,主要是生成的包(例如安卓apk)的簽名,與華為開發者平臺上應用設置裡面配置的不一致 ...
  • 即時通訊(Instant Messaging)是一種基於互聯網的即時交流消息的業務。 實時聊天交互功能是市面上主流APP的重要功能之一,人們所熟悉的就是微信,QQ的聊天消息系統,IM看似簡單,技術開發絕非易事,海量併發,超低延時,消息必達等高實時性需求需要眾多技術的應用合體; IM結合RTC可以... ...
  • pinia是一個vue的狀態存儲庫,你可以使用它來存儲、共用一些跨組件或者頁面的數據,使用起來和vuex非常類似。pina相對Vuex來說,更好的ts支持和代碼自動補全功能。本篇隨筆介紹pinia的基礎用法以及持久化存儲的一些用法,供參考學習。 pinia在2019年11月開始時候是一個實驗項目,目... ...
  • element組件的change方法預設獲取的只有選擇的id,如果同時我們想要獲得選中的name或其他數據則是不行的 這時候組件本身給我們提供了方法 下麵是使用方法 HTML <el-form-item label="排查地點" class="requireds-label"> <el-cascad ...
  • 寫過前端代碼大概率聽說過amd cmd umd commonjs esm這些名詞, 想當初我第一次看到這些的時候, 人都麻了, 都是些啥啊. 後來我知道了, 這些都是js的模塊規範. amd - 瀏覽器中的js模塊化解決方案 AMD全稱是Async Module Definition非同步模塊定義 R ...
  • web前端開發規範 規範概述 一個人走的更快,一群人可以走的更遠,前提是統一的策略,還要不斷地反省和優化。不管有多少人共同參與同一項目,儘可能確保每一行代碼都像是同一個人編寫的 開發目錄規範 開發環境規範 開發編碼規範 一、目錄及文件命名規範 (一)、例靜態專題頁目錄 - src / html 源代 ...
  • ELK 基本概述 ELK是Elasticsearch、Logstash、Kibana的簡稱,常常用於部署分散式系統日誌服務。 Elasticsearch:全球實時全文搜索和分析引擎,提供搜集、分析、存儲數據三大功能;是一套開放REST和JAVA API等結構提供高效搜索功能,可擴展的分散式系統。它構 ...
一周排行
    -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.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...