如何在 Kubernetes 部署 PostgreSQL

news2024/11/24 1:08:18

在这里插入图片描述

文章目录

    • 1. 简介
    • 2. 条件
    • 3. helm 部署 posgresql
      • 3.1 添加 Helm 存储库
      • 3.2 默认安装
      • 3.3 选参安装
      • 3.4 持久存储安装
        • 3.4.1 创建 PersistentVolume
        • 3.4.2 创建 PersistentVolumeClaim
        • 3.4.3 安装 Helm Chart
        • 3.4.5 连接到 PostgreSQL 客户端
      • 3.5 自定义配置 value.yaml
    • 4. 手动部署 postgresql
      • 4.1 创建 configmap
      • 4.2 创建 PersistentVolume & PersistentVolumeClaim
      • 4.3 创建 PostgreSQL Deployment
      • 4.4 创建 PostgreSQL Service
      • 4.5 kubectl 连接 PostgreSQL
      • 4.6 客户端 psql 连接 PostgreSQL

1. 简介

PostgreSQL是一个可靠且健壮的关系数据库系统,具有符合 ACID 的事务。它旨在处理各种规模的工作负载,非常适合个人使用和大规模部署,例如数据仓库、大数据服务器或 Web 服务。

2. 条件

  • 安装了kubectl的 Kubernetes 集群,我选择 kind 部署 kubernetes
  • 已安装 Helm 3

3. helm 部署 posgresql

Helm 为您提供了一种在 kubernetes 集群上部署 PostgreSQL 实例的快速简便的方法。

3.1 添加 Helm 存储库

在 Artifact Hub 中搜索要使用的 PostgreSQL Helm 图表。

$ helm search hub postgresql
URL                                                     CHART VERSION   APP VERSION     DESCRIPTION

https://artifacthub.io/packages/helm/cetic/post...      0.2.3           11.5.0          PostgreSQL is an open-source object-relational ...
https://artifacthub.io/packages/helm/wiremind/p...      8.7.0           11.7.0          DEPRECATED Chart for PostgreSQL, an object-rela...
https://artifacthub.io/packages/helm/request-re...      10.1.1          11.10.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/design-cat...      10.1.1          11.10.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/taalhuizen...      10.1.1          11.10.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/riftbit/po...      10.11.0         11.13.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/kubesphere...      1.0.3           11.11.0         Chart for PostgreSQL with HA architecture.
https://artifacthub.io/packages/helm/cloudve/po...      4.0.0           10.7.0          Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/reportport...      10.9.4          11.13.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/notificati...      10.1.1          11.10.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/authorizat...      10.1.1          11.10.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/jfrog/post...      10.3.18         11.11.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/radar-base...      11.1.24         14.2.0          PostgreSQL (Postgres) is an open source object-...
https://artifacthub.io/packages/helm/bitnami/po...      12.1.7          15.1.0          PostgreSQL (Postgres) is an open source object-...
https://artifacthub.io/packages/helm/forms-cata...      10.1.1          11.10.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/bitnami-ak...      12.1.2          15.1.0          PostgreSQL (Postgres) is an open source object-...
https://artifacthub.io/packages/helm/cloudnativ...      5.0.0           11.3.0          Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/wallet-com...      10.1.1          11.10.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/choerodon/...      3.18.4          10.7.0          Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/graphql-hi...      12.1.2          15.1.0          PostgreSQL (Postgres) is an open source object-...
https://artifacthub.io/packages/helm/duyet/post...      9.3.3           11.9.0          Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/goauthenti...      10.16.2         11.14.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/kubegemsap...      10.5.1          11.12.0         Chart for PostgreSQL, an object-relational data...
https://artifacthub.io/packages/helm/camptocamp...      0.7.1                           Object-relational database management system (O...
https://artifacthub.io/packages/helm/openstack-...      0.1.8           v9.6            OpenStack-Helm PostgreSQL

https://artifacthub.io/packages/helm/inseefrlab...      3.4.0           1               An object-relational database management system...
https://artifacthub.io/packages/helm/truecharts...      11.0.18         14.6.0          PostgresSQL

将 charts 的存储库添加到本地 Helm 安装:

添加 Bitnami Helm chart,添加存储库后,更新本地存储库

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

查看

$ helm repo list
NAME    URL
bitnami https://charts.bitnami.com/bitnami

3.2 默认安装

$ helm install psql-test1 bitnami/postgresql
NAME: psql-test1
LAST DEPLOYED: Tue Jan 10 00:18:49 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: postgresql
CHART VERSION: 12.1.7
APP VERSION: 15.1.0

** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:

    psql-test1-postgresql.default.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test1-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

To connect to your database run the following command:

    kubectl run psql-test1-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:15.1.0-debian-11-r19 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
      --command -- psql --host psql-test1-postgresql -U postgres -d postgres -p 5432

    > NOTE: If you access the container using bash, make sure that you execute "/opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash" in order to avoid the error "psql: local user with ID 1001} does not exist"

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test1-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432

查看状态

$ kubectl get all
NAME                          READY   STATUS    RESTARTS   AGE
pod/psql-test1-postgresql-0   1/1     Running   0          82s

NAME                               TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/kubernetes                 ClusterIP   10.96.0.1      <none>        443/TCP    15d
service/psql-test1-postgresql      ClusterIP   10.96.80.174   <none>        5432/TCP   82s
service/psql-test1-postgresql-hl   ClusterIP   None           <none>        5432/TCP   82s

NAME                                     READY   AGE
statefulset.apps/psql-test1-postgresql   1/1     82s

已经部署好 postgresql,下一步是连接到数据库。

$ export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test1-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

$ kubectl run psql-test1-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:15.1.0-debian-11-r19 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
>       --command -- psql --host psql-test1-postgresql -U postgres -d postgres -p 5432
If you don't see a command prompt, try pressing enter.

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" on host "psql-test1-postgresql" (address "10.96.80.174") at port "5432".

成功连接。

3.3 选参安装

根据所选的helm chart,可用的配置选项可能会有所不同。bitnami PostgreSQL chart 提供了大量选项,从简单的用户创建到复杂的安全配置,如设置证书和策略。所有可用的选项都列在 helm chart GitHub 页面上。

让我们看看一些常见的选项,例如更改用户名、密码、数据库名称和端口。这可以通过在安装 helm chart 时提供以下参数来完成。

$ helm install psql-test2 bitnami/postgresql --set global.postgresql.auth.username=testadmin --set global.postgresql.auth.password=testadmin123 --set global.postgresql.auth.database=testdb --set global.postgresql.service.ports.postgresql=5555
helm install psql-test2 bitnami/postgresql --set global.postgresql.auth.username=testadmin --set global.
postgresql.auth.password=testadmin123 --set global.postgresql.auth.database=testdb --set global.postgresql.service.ports.postgresql=5555
NAME: psql-test2
LAST DEPLOYED: Tue Jan 10 00:36:29 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: postgresql
CHART VERSION: 12.1.7
APP VERSION: 15.1.0

** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5555 on the following DNS names from within your cluster:

    psql-test2-postgresql.default.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

    export POSTGRES_ADMIN_PASSWORD=$(kubectl get secret --namespace default psql-test2-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

To get the password for "testadmin" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test2-postgresql -o jsonpath="{.data.password}" | base64 -d)

To connect to your database run the following command:

    kubectl run psql-test2-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:15.1.0-debian-11-r19 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
      --command -- psql --host psql-test2-postgresql -U testadmin -d testdb -p 5555

    > NOTE: If you access the container using bash, make sure that you execute "/opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash" in order to avoid the error "psql: local user with ID 1001} does not exist"

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test2-postgresql 5555:5555 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U testadmin -d testdb -p 5555

导出“testadmin”用户的密码,它将返回用户定义的密码。

$ export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test2-postgresql -o jsonpath="{.data.password}" | base64 -d)
$ echo $POSTGRES_PASSWORD
testadmin123

3.4 持久存储安装

3.4.1 创建 PersistentVolume

Postgres 数据库中的数据需要在 pod 重新启动后保持不变。

cat <<EOF> postgres-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: postgresql-pv
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
EOF
kubectl apply -f postgres-pv.yaml

3.4.2 创建 PersistentVolumeClaim

cat <<EOF> postgres-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgresql-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
EOF
 kubectl apply -f postgres-pvc.yaml

使用kubectl get检查PVC是否连接到PV成功:

$ kubectl get pvc
NAME                  STATUS   VOLUME          CAPACITY   ACCESS MODES   STORAGECLASS   AGE
postgresql-pv-claim   Bound    postgresql-pv   10Gi       RWO            manual         46s

3.4.3 安装 Helm Chart

执行:

$ helm install psql-test bitnami/postgresql --set persistence.existingClaim=postgresql-pv-claim --set volumePermissions.enabled=true
NAME: psql-test
LAST DEPLOYED: Mon Jan  9 18:21:18 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: postgresql
CHART VERSION: 12.1.7
APP VERSION: 15.1.0

** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS names from within your cluster:

    psql-test-postgresql.default.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

To connect to your database run the following command:

    kubectl run psql-test-postgresql-client --rm --tty -i --restart='Never' --namespace default --image docker.io/bitnami/postgresql:15.1.0-debian-11-r19 --env="PGPASSWORD=$POSTGRES_PASSWORD" \
      --command -- psql --host psql-test-postgresql -U postgres -d postgres -p 5432

    > NOTE: If you access the container using bash, make sure that you execute "/opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash" in order to avoid the error "psql: local user with ID 1001} does not exist"

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/psql-test-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432

查看状态

$ k get pods -w
NAME                     READY   STATUS     RESTARTS   AGE
psql-test-postgresql-0   0/1     Init:0/1   0          7s
psql-test-postgresql-0   0/1     Init:0/1   0          27s
psql-test-postgresql-0   0/1     PodInitializing   0          28s
psql-test-postgresql-0   0/1     Running           0          55s
psql-test-postgresql-0   1/1     Running           0          66s

3.4.5 连接到 PostgreSQL 客户端

导出POSTGRES_PASSWORD环境变量以便能够登录到 PostgreSQL 实例:

export POSTGRES_PASSWORD=$(kubectl get secret --namespace default psql-test-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)

打开另一个终端窗口并键入以下端口转发命令以转发 Postgres 端口:

$ kubectl port-forward --namespace default svc/psql-test-postgresql 5432:5432
Forwarding from 127.0.0.1:5432 -> 5432
Forwarding from [::1]:5432 -> 5432

最小化端口转发窗口并返回上一个。键入连接到 PostgreSQL 客户端 psql 的命令:

PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432
psql (9.6.22, server 15.1)
WARNING: psql major version 9.6, server major version 15.
         Some psql features might not work.
Type "help" for help.

postgres=#

如果没有安装psql,执行:sudo apt install postgresql-client-12

3.5 自定义配置 value.yaml

$ vim value.yaml
# define default database user, name, and password for PostgreSQL deployment
auth:
  enablePostgresUser: true
  postgresPassword: "StrongPassword"
  username: "app1"
  password: "AppPassword"
  database: "app_db"

# The postgres helm chart deployment will be using PVC postgresql-data-claim
primary:
  persistence:
    enabled: true
    existingClaim: "postgresql-pv-claim"

配置完成后,执行:

helm install postgresql-dev -f values.yaml bitnami/postgresql

4. 手动部署 postgresql

4.1 创建 configmap

提供数据库名称、用户名和登录 PostgreSQL 实例的密码。

$ vim  postgres-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-config
  labels:
    app: postgres
data:
  POSTGRES_DB: postgresdb
  POSTGRES_USER: admin
  POSTGRES_PASSWORD: test123

4.2 创建 PersistentVolume & PersistentVolumeClaim

$ vim postgres-storage.yaml
kind: PersistentVolume
apiVersion: v1
metadata:
  name: postgres-pv-volume
  labels:
    type: local
    app: postgres
spec:
  storageClassName: manual
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/mnt/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: postgres-pv-claim
  labels:
    app: postgres
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 5Gi

执行:

kubectl apply -f postgres-storage.yaml
$ kubectl get pvc
NAME                          STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
postgres-pv-claim             Bound    postgres-pv-volume                         5Gi        RWX            manual         32s

4.3 创建 PostgreSQL Deployment

$ vim postgres-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:10.1
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 5432
          envFrom:
            - configMapRef:
                name: postgres-config
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgredb
      volumes:
        - name: postgredb
          persistentVolumeClaim:
            claimName: postgres-pv-claim

执行:

kubectl apply -f postgres-deployment.yaml

4.4 创建 PostgreSQL Service

$ vim postgres-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  type: NodePort
  ports:
   - port: 5432
  selector:
   app: postgres

执行:

kubectl apply -f postgres-service.yaml

访问部署清单

$ kubectl get all
NAME                            READY   STATUS    RESTARTS   AGE
pod/postgres-5bb9d69b96-4lxr4   1/1     Running   0          15m

NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
service/kubernetes   ClusterIP   10.96.0.1      <none>        443/TCP          15d
service/postgres     NodePort    10.96.61.244   <none>        5432:30321/TCP   12m

NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/postgres   1/1     1            1           15m

NAME                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/postgres-5bb9d69b96   1         1         1       15m

您可以看到类型为 NodePort 的 postgres 服务在 Kubernetes 主机上为 PostgreSQL 客户端连接公开端口 30321,您的端口可能不同,因为 NodePort 是为您的服务随机选择的端口。NodePort 服务会在 30000-32767 之间随机为你的服务选择端口。

访问日志

$ kubectl logs postgres-5bb9d69b96-4lxr4
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok

syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....2023-01-09 15:25:13.980 UTC [45] LOG:  listening on IPv6 address "::1", port 5432
2023-01-09 15:25:13.980 UTC [45] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2023-01-09 15:25:13.982 UTC [45] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-01-09 15:25:14.011 UTC [46] LOG:  database system was shut down at 2023-01-09 15:25:13 UTC
2023-01-09 15:25:14.021 UTC [45] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE

CREATE ROLE


/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

2023-01-09 15:25:14.786 UTC [45] LOG:  received fast shutdown request
waiting for server to shut down....2023-01-09 15:25:14.787 UTC [45] LOG:  aborting any active transactions
2023-01-09 15:25:14.792 UTC [45] LOG:  worker process: logical replication launcher (PID 52) exited with exit code 1
2023-01-09 15:25:14.793 UTC [47] LOG:  shutting down
2023-01-09 15:25:14.811 UTC [45] LOG:  database system is shut down
 done
server stopped

PostgreSQL init process complete; ready for start up.

2023-01-09 15:25:14.913 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-01-09 15:25:14.913 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-01-09 15:25:14.915 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-01-09 15:25:14.948 UTC [72] LOG:  database system was shut down at 2023-01-09 15:25:14 UTC
2023-01-09 15:25:14.959 UTC [1] LOG:  database system is ready to accept connections

4.5 kubectl 连接 PostgreSQL

获取有关您与 PostgreSQL shell 的连接的信息

$ kubectl exec -ti postgres-5bb9d69b96-4lxr4 -- psql -h localhost -U admin --password -p 5432 postgresdb
Password for user admin:
psql (10.1)
Type "help" for help.

postgresdb=# \conninfo
You are connected to database "postgresdb" as user "admin" on host "localhost" at port "5432".

4.6 客户端 psql 连接 PostgreSQL

运行以下psql命令,将 IP 地址更改为10.89.0.3,一般为Kubernetes 主机 IP 地址,但kind部署的 kubernetes 集群分配给该集群另一个地址,,30321将端口更改为 NodePort 资源的端口。

$ kubectl get no -owide
NAME                 STATUS   ROLES           AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION                CONTAINER-RUNTIME
kind-control-plane   Ready    control-plane   15d   v1.25.3   10.89.0.3     <none>        Ubuntu 22.04.1 LTS   4.18.0-348.7.1.el8_5.x86_64   containerd://1.6.9

$ psql -h  10.89.0.3 -U admin --password -p 30321 postgresdb
Password for user admin:
psql (9.6.22, server 10.1)
WARNING: psql major version 9.6, server major version 10.
         Some psql features might not work.
Type "help" for help.

postgresdb=#  \conninfo
You are connected to database "postgresdb" as user "admin" on host "10.89.0.3" at port "30321".

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/151265.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Anaconda、CUDA、Pytorch安装

文章目录Anaconda、CUDA、Pytorch安装安装Anaconda安装CUDA安装cuDNN安装Pytorch小技巧验证原文链接&#xff1a; Tommy Shang的博客Anaconda、CUDA、Pytorch安装 很久没有更新博客&#xff0c;最近给实验室的机器安装Pytorch环境&#xff0c;顺手也把自己的机器装了一遍。 整…

《凤凰项目》读后感

无极限零部件公司的问题不提变更单导致变更引起很多问题&#xff0c;变更登记系统推行不下去不知道自己团队有多少项目在运行导致无法预估人力&#xff0c;进度怎么样&#xff0c;项目管理系统推行不下去安全部门提出各种安全问题&#xff0c;补丁安装审计部门提出各种审计不合…

Java学习之代码块

目录 一、代码块的基本介绍 二、基本语法 注意事项 三、代码块的好处和案例演示 四、注意事项和使用细节 第一点 第二点 第三点 案例演示 第四点 第五点 第六点 第七点 五、练习题 第一题 第二题 考察知识点 结论 结果 一、代码块的基本介绍 代码化块又称为初…

【论文导读】Deep Stable Learning for Out-Of-Distribution Generalization

DWR用到复杂数据集中。 看了一半发现一个博客将的也不错 放在这里Deep Stable Learning for Out-Of-Distribution Generalization_六点先生的博客-CSDN博客_随机傅里叶特征 目标任务&#xff1a; 一般假设&#xff08;训练数据的已知异质性&#xff08;如领域标签&#xff0…

FGH75T65SHD-F155 场截止沟槽 IGBT单管 应用于太阳能逆变器、UPS等多种应用

FGH75T65SHD-F155采用新型场截止 IGBT 技术&#xff0c;为太阳能逆变器、UPS、焊接机、电信、ESS 和 PFC 等低导通和开关损耗至关重要的应用提供最佳性能。 ONsemi安森美IGBT单管系列&#xff1a; FGH40N60SMD FGH60N60SMD FGH75T65SHD-F155 NGTB40N120FL2WG 特性&#x…

架构设计---用户加密处理

前言&#xff1a; 在互联网各种安全问题中&#xff0c;最能引发话题&#xff0c;刺激大众神经的就是用户的泄密问题&#xff0c;数据库被拖库导致所有的数据泄露&#xff0c;这种系统安全问题涉及的因素可能有很多&#xff0c;大部分和开发软件的程序员没有关系&#xff0c;但…

【PyTorch深度学习实践】03_反向传播

文章目录1.计算图2.反向传播2.1 链式求导法则2.2 反向传播过程3.Pytorch中前馈和反馈的计算3.1 Tensor3.2 代码演示对于简单的模型&#xff0c;梯度变换可以用解析式表达进行手算&#xff0c;但是复杂模型&#xff08;很多w&#xff0c;b&#xff09;的损失函数需要挨个写解析式…

【黑马】瑞吉外卖-Day03、04笔记

瑞吉外卖Day03、04 公共字段自动填充 使用MybatisPlus实现 问题分析 代码实现 Mybatis Plus公共字段自动填充&#xff0c;也就是在插入或者更新的时候为指定字段赋予指定的值&#xff0c;使用它的好处就是可以统一对这些字段进行处理&#xff0c;避免了重复代码。 实现步骤…

【学习】life long learning

文章目录life long learningLLL的难点评估二、LLL的三个解法1、Selective Synaptic Plasticity选择性突触可塑性为什么会有灾难性遗忘呢&#xff1f;GEM2、Additional Neural Resource Allocation额外的神经资源分配packNet&CPG3、memory replyCurriculum Learninglife lon…

SAP 字段仍作为视图字段在视图中使用 | 更改表结构重新生成 CDS View「实例」

错误信息 Field ZPDAUSER-ZUSERID is still being used as a view field in view ZV_PDA_USER视图 ZPDAUSER-ZUSERID 仍作为视图字段在视图 ZV_PDA_USER 使用 错误原因 当前表被 CDS View 引用&#xff0c;由 CDS View 生成的「视图」已占用当前表的相关字段然而生成的视图又…

实战5:基于 Pytorch 搭建 Faster-R-CNN 实现飞机目标检测(代码+数据)

任务描述: 通过一个飞机检测的案例来对目标检测的基本概念进行介绍并且实现一个简单的目标检测方法。数据集:使用从COCO数据集抽取的飞机数据集mini-airplane,数据集中的数据均为正常的图片。https://download.csdn.net/download/qq_38735017/87374251运行环境:操作系统:l…

Day4 基于XML的Spring应用

总结java依赖注入的方式set方法注入List、map和properties的注入通过构造方法注入ref是reference的缩写&#xff0c;需要引用其他bean的id&#xff0c;value用于注入普通属性值。自定义标签和其他标签的引用自定义标签beansbeanimportalias其他标签用于引用其他命名空间1 bean的…

sqli-labs 第八关 多命通关攻略(Python3 自动化实现布尔盲注)

sqli-labs 第八关 多命通关攻略&#xff08;Python3 自动化实现布尔盲注&#xff09;描述判断注入类型正常输入不正常输入错误输入爆破方式的可行性铺垫函数 IF()关于 MySQL 数据类型之间转换的小小礼物&#xff08;仅部分&#xff09;函数 ASCII()ASCII 表&#xff08;可显示字…

火山引擎 DataTester:5 个优化思路,构建高性能 A/B 实验平台

导读&#xff1a;DataTester 是由火山引擎推出的 A/B 测试平台&#xff0c;覆盖推荐、广告、搜索、UI、产品功能等业务应用场景&#xff0c;提供从 A/B 实验设计、实验创建、指标计算、统计分析到最终评估上线等贯穿整个 A/B 实验生命周期的服务。DataTester 经过了字节跳动业务…

vivo 故障定位平台的探索与实践

作者&#xff1a;vivo 互联网服务器团队- Liu Xin、Yu Dan 本文基于故障定位项目的实践&#xff0c;围绕根因定位算法的原理进行展开介绍。鉴于算法有一定的复杂度&#xff0c;本文通过图文的方式进行说明&#xff0c;希望即使是不懂技术的同学也能理解。 一、背景介绍 1.1 程…

2023最新连锁店软件排名,国内十大连锁店管理软件新鲜出炉!

普通的数据工具、人工管理难以满足连锁店老板们的需求&#xff0c;正所谓“有需求就有市场”&#xff0c;随着连锁店、加盟店如雨后春笋般在城市里出现&#xff0c;连锁店软件也越来越多。究竟哪一款连锁店管理软件&#xff0c;才能满足老板们的需求&#xff1f;小编收集了国内…

9/365 java 数组 内存

1.数组 声明&#xff1a; int[] a;//首选 int a[];//一般不用 创建&#xff1a; int[] a new int[10]; // 需指定数组大小 初始化&#xff1a; 静态初始化&#xff1a; int[] a {8,9,10}; String[] s {new String("hello"), new String("world")…

南邮研究生考试历年真题知识点总结

下边的知识点是我在做南京邮电大学考研历年真题时遇到自己不会的题时整理出来的。第九部分是做mooc课后习题时整理出来的&#xff0c;希望对各位同学有所帮助。 md文档网址&#xff1a;https://gitee.com/infiniteStars/wang-dao-408-notes/blob/master/考研笔记/南邮数据结构知…

内存函数:学习笔记7

目录 一.前言 二. memcpy模拟实现 三. memmove模拟实现 四.memcmp模拟实现 一.前言 计算机内存的实质就是以字节为编号单元的二进制序列集合&#xff0c;操作内存时我们应具有这样的视角。 二. memcpy模拟实现 库函数memcpy函数首部&#xff1a;void *memcpy( void *dest, …

量子计算机“九章”

1.中国量子计算机“九章”实现量子霸权 2020年12月&#xff0c;中国科学技术大学宣布该校成功构建光子量子计算原型机“九章”。“九章”是中国科学技术大学潘建伟团队、中科院上海微系统所和国家并行计算机工程技术研究中心合作完成。“九章”的名字是来源于中国历史上最重要…