国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Kubernetes-03-實踐篇 Spring-cloud-kubernetes 自動引入 K8S的 ConfigMap 參數(shù)(參數(shù)引用 和 文件掛載)

這篇具有很好參考價值的文章主要介紹了Kubernetes-03-實踐篇 Spring-cloud-kubernetes 自動引入 K8S的 ConfigMap 參數(shù)(參數(shù)引用 和 文件掛載)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

此篇文章中,我們將講述如何從configMap中引入?yún)?shù)配置,如何從掛載文件中引入文件配置。其中文件掛載是應用部署中常見的形式。

  • 1、通過 valueRef 引入 ConfigMap 配置信息
    • 1.1: 初始化項目
    • 1.2: 定義將外部引入的配置項
    • 1.3: 構建鏡像 & 發(fā)布應用
    • 1.4: 確認配置的引用
  • 2、通過 fileMount 引入 ConfigMap 配置信息
    • 2.1: 初始化項目
    • 2.2: 定義將外部引入的配置項
    • 2.3: 構建 & 發(fā)布鏡像
    • 2.4: 確認配置的引用

組件版本說明:

  • SpringBoot:3.1.0
  • SpringCloud:4.0.4
  • SpringCloudKubernetes:3.0.4
  • JDK17

1、通過 valueRef 引入 ConfigMap 配置信息

1.1: 初始化項目

引入maven依賴,核心依賴:spring-cloud-kubernetes-fabric8-config

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-kubernetes-fabric8-config</artifactId>
            <version>${springcloud-kubernetes-fabric8.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.22</version>
        </dependency>
    </dependencies>

1.2: 定義將外部引入的配置項

在 application.yaml 中定義

spring:
  application:
    name: springboot-cloud-k8s-config-valueref
greeting:
  message: ${GREETING_MESSAGE:nice to meet you}
farewell:
  message: ${FAREWELL_MESSAGE:see you next time}

在ConfigMap中定義對應的參數(shù)

apiVersion: v1
kind: ConfigMap
metadata:
  name: springboot-k8s-config-valueref
  labels:
    app: springboot-k8s-config-valueref
data:
  GREETING_MESSAGE: "Say Hello to the World outside"

我們定義兩個不同的ConfigMap便于更好地演示

apiVersion: v1
kind: ConfigMap
metadata:
  name: springboot-k8s-config-valueref2
  labels:
    app: springboot-k8s-config-valueref
data:
  farewell.message: "Say Farewell to the World outside"

1.3: 構建鏡像 & 發(fā)布應用

通過maven指令編譯一個鏡像

 <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker.maven.plugin.version}</version>
                <executions>
                    <!--如果想在項目打包時構建鏡像添加-->
                    <execution>
                        <id>build-image</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <images>
                        <image>
                            <name>org/${project.artifactId}:${project.version}</name>
                            <build>
                                <dockerFile>${project.basedir}/Dockerfile</dockerFile>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
</plugins>

可以通過maven指令或IDE的插件

mvn clean package -Dmaven.test.skip=true

執(zhí)行后,就可以將構建的鏡像推送至本地/遠程倉庫

REPOSITORY                           TAG                IMAGE ID            CREATED             SIZE
org/springboot-k8s-config-valueref   1.0-SNAPSHOT       8902aa877999        6 seconds ago       564MB

通過插件,可以進行應用打包 -> 構建docker鏡像 -> 在本地/遠程倉庫中覆蓋更新相同版本的鏡像 -> 并清除本地臨時文件
接下來,我們可以通過倉庫中的鏡像,發(fā)布一個pod
這邊使用 configMapRef & configMapKeyRef 進行引用 :

test.yaml示例文件如下:

apiVersion: v1
kind: List
items:
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: springboot-k8s-config-valueref
      labels:
        app: springboot-k8s-config-valueref
    data:
      GREETING_MESSAGE: "Say Hello to the World outside"
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: springboot-k8s-config-valueref2
      labels:
        app: springboot-k8s-config-valueref
    data:
      farewell.message: "Say Farewell to the World outside"
  - apiVersion: v1
    kind: Service
    metadata:
      labels:
        app: springboot-k8s-config-valueref
      name: springboot-k8s-config-valueref
    spec:
      type: NodePort
      selector:
        app: springboot-k8s-config-valueref
      ports:
        - nodePort: 30163
          port: 8080
          protocol: TCP
          targetPort: 8080
  - apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: springboot-k8s-config-valueref
      labels:
        app: springboot-k8s-config-valueref
        group: org.example
    spec:
      strategy:
        type: Recreate
      replicas: 1
      selector:
        matchLabels:
          app: springboot-k8s-config-valueref
      template:
        metadata:
          labels:
            app: springboot-k8s-config-valueref
        spec:
          volumes:
            - name: autoconfig
          containers:
            - name: springboot-k8s-config-valueref
              image: org/springboot-k8s-config-valueref:1.0-SNAPSHOT
              imagePullPolicy: IfNotPresent
              ports:
                - containerPort: 8080
              envFrom:
                - configMapRef:
                    name: springboot-k8s-config-valueref
              env:
                - name: FAREWELL_MESSAGE
                  valueFrom:
                    configMapKeyRef:
                      name: springboot-k8s-config-valueref2
                      key: farewell.message

執(zhí)行情況如下:

$ kubectl apply -f ~/springboot-demo/springboot-config-k8s-valueref/src/main/resources/deploy-valueref.yaml
configmap/springboot-k8s-config-valueref created
configmap/springboot-k8s-config-valueref2 created
service/springboot-k8s-config-valueref created
deployment.apps/springboot-k8s-config-valueref created
$ kubectl get pods
NAME                                              READY   STATUS    RESTARTS   AGE
springboot-k8s-config-valueref-57d464c66c-tg8nw   1/1     Running   0          3s
$ kubectl logs -f springboot-k8s-config-valueref-57d464c66c-tg8nw

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.0)

2023-09-18T12:17:05.206Z  INFO 1 --- [           main] org.example.BootValueRefApplication      : Starting BootValueRefApplication using Java 17.0.8 with PID 1 (/opt/app/springboot-k8s-config-valueref-1.0-SNAPSHOT.jar started by root in /opt/app)
2023-09-18T12:17:05.215Z  INFO 1 --- [           main] org.example.BootValueRefApplication      : The following 1 profile is active: "kubernetes"
2023-09-18T12:17:07.260Z  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=cc47999e-9518-3998-aa7d-05324c2cb413
2023-09-18T12:17:08.015Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-09-18T12:17:08.028Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-09-18T12:17:08.029Z  INFO 1 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.8]
2023-09-18T12:17:08.150Z  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-09-18T12:17:08.153Z  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2632 ms
2023-09-18T12:17:09.339Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-09-18T12:17:09.412Z  INFO 1 --- [           main] org.example.BootValueRefApplication      : Started BootValueRefApplication in 6.462 seconds (process running for 7.914)

經(jīng)過以上步驟,一個簡單的應用已經(jīng)順利地跑起來了

1.4: 確認配置的引用

這邊測試是采用 minikube 在本地搭建 K8S集群。
由于本地環(huán)境,需要講暴露服務來訪問,minikube service springboot-k8s-config-valueref --url

minikube service springboot-k8s-config-valueref --url
http://127.0.0.1:51650
?  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

請求服務API

$ curl http://127.0.0.1:51650
hello, 'Say Hello to the World outside', goodbye, 'Say Farewell to the World outside'

返回在外部ConfigMap中配置的參數(shù),通過configMapRef 和 configMapKeyRef 均可以獲取到參數(shù)

2、通過 fileMount 引入 ConfigMap 配置信息

以下通過文件掛載的常見形式加載服務變量,通常直接掛載到jar的執(zhí)行目錄下的/config目錄,作為springboot加載配置文件的第一優(yōu)先級,無需指定自動讀取

2.1: 初始化項目

引入maven依賴,核心依賴:spring-cloud-kubernetes-fabric8-config

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-kubernetes-fabric8-config</artifactId>
            <version>${springcloud-kubernetes-fabric8.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.22</version>
        </dependency>
    </dependencies>

2.2: 定義將外部引入的配置項

在 application.yaml 中定義參數(shù),部分文件掛載的參數(shù)可以不在文件中定義

server:
  port: 8080
spring:
  application:
    name: springboot-k8s-config-filemount
dbuser: ${DB_USERNAME:default}
dbpassword: ${DB_PASSWORD:default}

定義 configmap

apiVersion: v1
kind: ConfigMap
metadata:
  name: springboot-k8s-config-filemount
  labels:
    app: springboot-k8s-config-filemount
data:
  application.yaml: |-
    greeting:
      message: "Say Hello to the World outside"
    farewell:
      message: "Say Goodbye to the World outside"

定義配置類:

@Data
@Configuration
public class DbConfig {
    @Value("${dbuser}")
    private String dbUsername;
    @Value("${dbpassword}")
    private String dbPassword;
}

@Data
@Configuration
public class MyConfig {

    @Value("${greeting.message:'default greeting message'}")
    private String greetingMessage;
    @Value("${farewell.message:'default farewell message'}")
    private String farewellMessage;
}

2.3: 構建 & 發(fā)布鏡像

通過 maven compiler 構建鏡像

 <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${spring-boot.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker.maven.plugin.version}</version>
                <executions>
                    <!--如果想在項目打包時構建鏡像添加-->
                    <execution>
                        <id>build-image</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <images>
                        <image>
                            <name>org/${project.artifactId}:${project.version}</name>
                            <build>
                                <dockerFile>${project.basedir}/Dockerfile</dockerFile>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
</plugins>

通過指令 或 IDE 插件,將鏡像打包

mvn clean package -Dmaven.test.skip=true

將鏡像推到倉庫

$ docker images
REPOSITORY                                TAG              IMAGE ID       CREATED          SIZE
org/springboot-config-k8s-filemount      1.0-SNAPSHOT     f93c2e1254d5   42 seconds ago   628MB

根據(jù)鏡像,發(fā)布一個Pod

使用 volumes 引入掛載的文件
使用 volumeMounts 指定掛載的文件
針對secret的數(shù)據(jù)需要在配置前加密,可以使用指定來獲取base64加密后的數(shù)據(jù): echo -n root | base64,然后再填充到文件中

$ echo -n root | base64
cm9vdA==

樣例文件:test.yaml:

apiVersion: v1
kind: List
items:
  - apiVersion: v1
    kind: Secret
    metadata:
      name: springboot-k8s-config-filemount-secret
      labels:
        app: springboot-k8s-config-filemount
    data:
      dbuser: cm9vdA==
      dbpassword: cGFzc3dvcmQ=
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: springboot-k8s-config-filemount
      labels:
        app: springboot-k8s-config-filemount
    data:
      application.yaml: |-
        greeting:
          message: "Say Hello to the World outside"
        farewell:
          message: "Say Goodbye to the World outside"
  - apiVersion: v1
    kind: Service
    metadata:
      labels:
        app: springboot-k8s-config-filemount
      name: springboot-k8s-config-filemount
    spec:
      type: NodePort
      selector:
        app: springboot-k8s-config-filemount
      ports:
        - nodePort: 30163
          port: 8080
          protocol: TCP
          targetPort: 8080
  - apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: springboot-k8s-config-filemount
      labels:
        app: springboot-k8s-config-filemount
        group: org.example
    spec:
      strategy:
        type: Recreate
      replicas: 1
      selector:
        matchLabels:
          app: springboot-k8s-config-filemount
      template:
        metadata:
          labels:
            app: springboot-k8s-config-filemount
        spec:
          volumes:
            - name: config-volume
              configMap:
                name: springboot-k8s-config-filemount
                items:
                  - key: application.yaml
                    path: application.yaml
          containers:
            - name: springboot-k8s-config-filemount
              image: org/springboot-config-k8s-filemount:1.0-SNAPSHOT
              imagePullPolicy: IfNotPresent
              ports:
                - containerPort: 8080
              env:
                - name: DB_USERNAME
                  valueFrom:
                    secretKeyRef:
                      name: springboot-k8s-config-filemount-secret
                      key: dbuser
                - name: DB_PASSWORD
                  valueFrom:
                    secretKeyRef:
                      name: springboot-k8s-config-filemount-secret
                      key: dbpassword
              volumeMounts:
                - name: config-volume
                  mountPath: /opt/app/config/application.yaml
                  subPath: application.yaml

使用 kubectl apply -f test.yaml 的方式發(fā)布Pod

$ kubectl apply -f ~/springboot-demo/springboot-config-k8s-filemount/src/main/resources/deploy-filemount.yaml
secret/springboot-k8s-config-filemount-secret created
configmap/springboot-k8s-config-filemount created
service/springboot-k8s-config-filemount created
deployment.apps/springboot-k8s-config-filemount created
$ kubectl get pods
NAME                                               READY   STATUS    RESTARTS   AGE
springboot-k8s-config-filemount-89d6bdfcd-vvkqz   1/1     Running   0          3s
$ kubectl logs springboot-k8s-config-filemount-89d6bdfcd-vvkqz

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.0)

2023-09-20T10:38:40.477Z  INFO 1 --- [           main] org.example.BootFilemountApplication    : Starting BootFileamountApplication using Java 17.0.8 with PID 1 (/opt/app/springboot-config-k8s-filemount-1.0-SNAPSHOT.jar started by root in /opt/app)
2023-09-20T10:38:40.480Z  INFO 1 --- [           main] org.example.BootFilemountApplication    : The following 1 profile is active: "kubernetes"
2023-09-20T10:38:42.402Z  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=49502b73-ffac-39f1-a249-dec4d3facce7
2023-09-20T10:38:43.379Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-09-20T10:38:43.402Z  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-09-20T10:38:43.403Z  INFO 1 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.8]
2023-09-20T10:38:43.517Z  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-09-20T10:38:43.520Z  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2845 ms
2023-09-20T10:38:44.714Z  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-09-20T10:38:44.792Z  INFO 1 --- [           main] org.example.BootFilemountApplication    : Started BootFilemountApplication in 6.37 seconds (process running for 8.022)

應用啟動,準備測試

2.4: 確認配置的引用

暴露端口 minikube service springboot-k8s-config-filemount --url

minikube service springboot-k8s-config-filemount --url
http://127.0.0.1:55369
?  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

請求接口,獲取注入的參數(shù)值

$ curl http://127.0.0.1:55369
hello, 'Say Hello to the World outside', goodbye, 'Say Goodbye to the World outside'. myname: 'root', mypass: 'password' 

參數(shù)值獲取成功注入的參數(shù)文章來源地址http://www.zghlxwxcb.cn/news/detail-772871.html

到了這里,關于Kubernetes-03-實踐篇 Spring-cloud-kubernetes 自動引入 K8S的 ConfigMap 參數(shù)(參數(shù)引用 和 文件掛載)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內(nèi)容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • 「ML 實踐篇」模型訓練

    「ML 實踐篇」模型訓練

    在訓練不同機器學習算法模型時,遇到的各類訓練算法大多對用戶都是一個黑匣子,而理解它們實際怎么工作,對用戶是很有幫助的; 快速定位到合適的模型與正確的訓練算法,找到一套適當?shù)某瑓?shù)等; 更高效的執(zhí)行錯誤調(diào)試、錯誤分析等; 有助于理解、構建和訓練神經(jīng)

    2023年04月16日
    瀏覽(25)
  • 安卓與串口通信-實踐篇

    安卓與串口通信-實踐篇

    在上一篇文章中我們講解了關于串口的基礎知識,沒有看過的同學推薦先看一下,否則你可能會不太理解這篇文章所述的某些內(nèi)容。 這篇文章我們將講解安卓端的串口通信實踐,即如何使用串口通信實現(xiàn)安卓設備與其他設備例如PLC主板之間數(shù)據(jù)交互。 需要注意的是正如上一

    2024年02月16日
    瀏覽(27)
  • 程序員職業(yè)規(guī)劃-實踐篇

    程序員職業(yè)規(guī)劃-實踐篇

    你是否認真思考過3-5年、10年: 你想成為什么樣的人 ? 作為一名技術人,我們應認真規(guī)劃自己的職業(yè)發(fā)展,不再焦慮、為自己加速~ 一塊留言來聊聊吧~ 你該去什么樣的公司、做什么樣的事情、拿多少錢,都取決于一個問題: 你想成為什么樣的人 ? 你是否認真思考過3-5年、

    2024年02月05日
    瀏覽(27)
  • 【實踐篇】推薦算法PaaS化探索與實踐 | 京東云技術團隊

    【實踐篇】推薦算法PaaS化探索與實踐 | 京東云技術團隊

    作者:京東零售 崔寧 目前,推薦算法部支持了主站、企業(yè)業(yè)務、全渠道等20+業(yè)務線的900+推薦場景,通過梳理大促運營、各垂直業(yè)務線推薦場景的共性需求,對現(xiàn)有推薦算法能力進行沉淀和積累,并通過算法PaaS化打造通用化的推薦能力,提升各業(yè)務場景推薦賦能效率,高效賦

    2024年02月15日
    瀏覽(26)
  • 微服務實戰(zhàn)系列之ZooKeeper(實踐篇)

    微服務實戰(zhàn)系列之ZooKeeper(實踐篇)

    關于 ZooKeeper ,博主已完整的通過庖丁解牛式的 “解法” ,完成了概述。我想掌握了這些基礎原理和概念后,工作的問題自然迎刃而解,甚至offer也可能手到擒來,真實一舉兩得,美極了。 為了更有直觀的體驗,強化概念,博主特別獻上一篇實踐文章。理論聯(lián)系實踐,才能學

    2024年01月21日
    瀏覽(31)
  • 「ML 實踐篇」分類系統(tǒng):圖片數(shù)字識別

    「ML 實踐篇」分類系統(tǒng):圖片數(shù)字識別

    目的 :使用 MNIST 數(shù)據(jù)集,建立數(shù)字圖像識別模型,識別任意圖像中的數(shù)字; MNIST ,一組由美國高中生和人口調(diào)查局員工手寫的 70000 個數(shù)字圖片;每張圖片都用其代表的數(shù)字標記;因廣泛被應用于機器學習入門,被稱作機器學習領域的 Hello World ;也可用于測試新分類算法的

    2023年04月08日
    瀏覽(28)
  • 瑞芯微RK3568開發(fā):GPIO實踐篇

    瑞芯微RK3568開發(fā):GPIO實踐篇

    ? ? ? ? SOC平臺各類GPIO構建原理是大道一統(tǒng)的,在各個諸如狀態(tài)、數(shù)據(jù)、中斷和屏蔽等寄存器具體含義用法,有少許差異。玩好RK的GPIO,需要先理解這類通用接口的框架。 ? ? ? ? 介紹RK3568的GPIO,認為講2類重要地址和記錄幾種編程實踐方法即可。 一、2類地址 ? ? ? ? RK

    2024年02月10日
    瀏覽(163)
  • 【實踐篇】DDD腳手架及編碼規(guī)范

    我們團隊一直在持續(xù)推進業(yè)務系統(tǒng)的體系化治理工作,在這個過程中我們沉淀了自己的DDD腳手架項目。腳手架項目是體系化治理過程中比較重要的一環(huán),它的作用有兩點: (1)可以對新建的項目進行統(tǒng)一的規(guī)范; (2)對于指導老項目進行DDD的改造提供指導。 本文主要是梳

    2024年02月11日
    瀏覽(28)
  • 【實踐篇】領域驅(qū)動設計:DDD工程參考架構

    不同團隊落地DDD所采取的應用架構風格可能不同,并沒有統(tǒng)一的、標準的DDD工程架構。有些團隊可能遵循經(jīng)典的DDD四層架構,或改進的DDD四層架構,有些團隊可能綜合考慮分層架構、整潔架構、六邊形架構等多種架構風格,有些在實踐中可能引入CQRS解決讀模型與寫模型的差異

    2024年02月05日
    瀏覽(23)
  • Redis【實踐篇】之RedisTemplate基本操作

    Redis【實踐篇】之RedisTemplate基本操作

    在SpringBoot中,可以使用RedisTemplate來操作Redis數(shù)據(jù)庫。RedisTemplate是Spring Data Redis提供的一個強大的Redis客戶端,它支持各種Redis數(shù)據(jù)結構,并提供了許多方便的方法來操作這些數(shù)據(jù)結構。下面是一些RedisTemplate的用法示例: 在此示例中,創(chuàng)建了一個RedisTemplate對象,并設置了key和

    2024年02月16日
    瀏覽(31)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包