postgres+timescaledb--离线安装,centos7.9

操作系统是centos7.9,使用的hper-V,安装的虚拟机环境,安装好操作系统之后,让系统不连外网后直接按下方操作安装。

方式1,使用压缩包,复杂一点。(第一种方式暂时没有安装timescaledb)

装备安装包

  1. postgresf服务安装包
    在这里插入图片描述
  2. 下载之后通过优盘或者ssh进入目标服务器,拷贝进去
    将下载的源码上传至目标服务器,这里我上传到:/usr/local/postgres14.5/src,我们可以创建这个目录,然后在上传到这个目录下

mkdir -p /usr/local/postgresql-16.4/src/

下图是我已经解压缩得到的文件夹postgresql-16.4:tar -xzvf postgresql-16.4.tar.gz
在这里插入图片描述

安装gcc环境

[roy@localhost my_gcc]$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

安装icu库

[roy@localhost postgresql-16.4]$ rpm -q libicu
libicu-50.2-4.el7_7.x86_64

在这一步之前我是安装了libicud的,不过用的是libicu-50.2-4.el7_7.x86_64.rpm包,可能不需要上面这步,可以试试看

[roy@localhost postgresql-16.4]$ sudo rpm -Uvh /home/roy/libicu-devel-50.2-4.el7_7.x86_64.rpm
[sudo] password for roy:
Sorry, try again.
[sudo] password for roy:
warning: /home/roy/libicu-devel-50.2-4.el7_7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:libicu-devel-50.2-4.el7_7        ################################# [100%]

安装zlib

这里需要注意的是安装zlib-devel库需要zlib库,但是系统之前就已经安装了zlib,需要先看看它的版本rpm -qa | grep zlib,不然下载的zlib-devel库会安装不好。

[roy@localhost postgresql-16.4]$ rpm -qa | grep zlib
zlib-1.2.7-18.el7.x86_64
[roy@localhost postgresql-16.4]$ sudo rpm -Uvh /home/roy/zlib-devel-1.2.7-18.el7.x86_64.rpm
[sudo] password for roy:
warning: /home/roy/zlib-devel-1.2.7-18.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:zlib-devel-1.2.7-18.el7          ################################# [100%]

安装postgres

[roy@localhost postgresql-16.4]$ ./configure --prefix=/usr/local/my_pgsql16.4 --with-pgport=5432

在这里插入图片描述
没有报错即可
在这里插入图片描述

接下来执行编译和安装(编译的时间有点长,等会儿)

最好使用管理员权限

make
make install

创建用户组,用户,修改相关文件夹权限。(这个方法中/run/media/postgres/data路径似乎在主机重启或者过一段时间就会被删除,暂时不确定是什么原因。)

[roy@localhost postgresql-16.4]$ groupadd postgres
groupadd: Permission denied.
groupadd: cannot lock /etc/group; try again later.
[roy@localhost postgresql-16.4]$ sudo groupadd postgres
[sudo] password for roy:
[roy@localhost postgresql-16.4]$ sudo useradd -g postgres postgres_dky
[roy@localhost postgresql-16.4]$ mkdir -p /run/media/postgres/data
mkdir: cannot create directory '/run/media': Permission denied
[roy@localhost postgresql-16.4]$ sudo mkdir -p /run/media/postgres/data
[roy@localhost postgresql-16.4]$ chmod -R 777 /run/media/
chmod: changing permissions of '/run/media/': Operation not permitted
chmod: changing permissions of '/run/media/postgres': Operation not permitted
chmod: changing permissions of '/run/media/postgres/data': Operation not permitted
[roy@localhost postgresql-16.4]$ sudo chmod -R 777 /run/media/
[roy@localhost postgresql-16.4]$ sudo chmod -R 777 /usr/local/my_pgsql16.4/bin/
[roy@localhost postgresql-16.4]$ sudo chown postgres_dky /run/media/postgres/data
[roy@localhost postgresql-16.4]$ chown postgres_dky /usr/local/my_pgsql16.4/bin/initdb
chown: changing ownership of '/usr/local/my_pgsql16.4/bin/initdb': Operation not permitted
[roy@localhost postgresql-16.4]$ sudo chown postgres_dky /usr/local/my_pgsql16.4/bin/initdb
#切换用户
[roy@localhost postgresql-16.4]$ su - postgres_dky
Password:
su: Authentication failure
# 检查是否有用户 postgres_dky。可以用以下命令列出所有用户:
[roy@localhost postgresql-16.4]$ cat /etc/passwd | grep postgres_dky
postgres_dky:x:1001:1001::/home/postgres_dky:/bin/bash
# 有时用户账户可能被锁定。可以用如下命令检查账户状态:
# 用户 postgres_dky 的账户当前被锁定(Password locked)
[roy@localhost postgresql-16.4]$ sudo passwd -S postgres_dky
postgres_dky LK 2024-10-24 0 99999 7 -1 (Password locked.)
# 使用 sudo passwd 命令解除密码锁定状态
#但由于该用户没有设置密码,系统提示您密码将为空。您需要先设置一个密码,然后才能解锁用户
[roy@localhost postgresql-16.4]$ sudo passwd -u postgres_dky
Unlocking password for user postgres_dky.
passwd: Warning: unlocked password would be empty.
passwd: Unsafe operation (use -f to force)
[roy@localhost postgresql-16.4]$ su - postgres_dky
Password:
su: Authentication failure
# 使用以下命令设置一个新密码:
[roy@localhost postgresql-16.4]$ sudo passwd postgres_dky
Changing password for user postgres_dky.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[roy@localhost postgresql-16.4]$ su - postgres_dky
Password:
Last failed login: Thu Oct 24 14:15:56 CST 2024 on pts/0
There were 4 failed login attempts since the last successful login.
# 切换成功
[postgres_dky@localhost ~]$

执行初始化命令

[postgres_dky@localhost ~]$ /usr/local/my_pgsql16.4/bin/initdb -D /run/media/postgres/data
The files belonging to this database system will be owned by user "postgres_dky".
This user must also own the server process.The database cluster will be initialized with locale "en_US.UTF-8".
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 /run/media/postgres/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... okinitdb: warning: enabling "trust" authentication for local connections
initdb: hint: 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:/usr/local/my_pgsql16.4/bin/pg_ctl -D /run/media/postgres/data -l logfile start

启动关闭数据库
注意,启动关闭需要保证是在我们postgres用户之下

[postgres_dky@localhost ~]$ /usr/local/my_pgsql16.4/bin/pg_ctl  -D /run/media/postgres/data -l logfile start
waiting for server to start.... done
server started

关闭数据库

/usr/local/my_pgsql16.4/bin/pg_ctl -D /run/media/postgres/data -l logfile stop

修改数据库密码

# 创建psql连接,这里需要在root用户下执行,否则会提示拒绝
[postgres_dky@localhost ~]$ su -
Password:
Last login: Thu Oct 24 09:35:54 CST 2024 on pts/0
[root@localhost ~]# ln -s /usr/local/my_pgsql16.4/bin/psql /usr/bin/psql
# 创建连接以后,在切回到pg数据库用户
[root@localhost ~]# su - postgres_dky
Last login: Thu Oct 24 14:17:13 CST 2024 on pts/0
[postgres_dky@localhost ~]$ psql -lList of databasesName    |    Owner     | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |       Access privileges
-----------+--------------+----------+-----------------+-------------+-------------+------------+-----------+-------------------------------postgres  | postgres_dky | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           |template0 | postgres_dky | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres_dky              +|              |          |                 |             |             |            |           | postgres_dky=CTc/postgres_dkytemplate1 | postgres_dky | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres_dky              +|              |          |                 |             |             |            |           | postgres_dky=CTc/postgres_dky
(3 rows)

使用psql工具访问数据库


[postgres_dky@localhost ~]$ psql -U postgres_dky -d postgres
psql (16.4)
Type "help" for help.postgres=# alter role postgres_dky with password 'your new password';
ALTER ROLE
postgres= exit

数据库的配置文件postgresql.conf

[root@localhost ~]# ls /run/media/postgres/data
base    pg_commit_ts  pg_hba.conf    pg_logical    pg_notify    pg_serial     pg_stat      pg_subtrans  pg_twophase  pg_wal   postgresql.auto.conf  postmaster.opts
global  pg_dynshmem   pg_ident.conf  pg_multixact  pg_replslot  pg_snapshots  pg_stat_tmp  pg_tblspc    PG_VERSION   pg_xact  postgresql.conf       postmaster.pid

开启远程访问
编辑postgresql.conf

在这里插入图片描述
:“

编辑pg_hba.conf
修改pg_hba.conf 添加远程访问的认证方式,未尾添加 host all all 0.0.0.0/0 md5

在这里插入图片描述
重启数据库

# start stop restart
/usr/local/my_pgsql16.4/bin/pg_ctl -D /run/media/postgres/data -l logfile restart

开放端口,提供给外部访问。

#查看已开放的端口
firewall-cmd --list-ports#开放
firewall-cmd --permanent --zone=public --add-port=5432/tcp#重启防火墙
firewall-cmd --reload

参考:centos离线使用源码安装Postgre SQL

方式二:多个rpm包,并且安装timescaledb

装备安装包

你需要准备这些包,以及一个libicu-50.2-4.el7_7.x86_64.rpm包,安装postgresql15-15.8-1PGDG.rhel7.x86_64.rpm需要libicu

[roy@localhost 138server]$ cd PostgreSQL/
[roy@localhost PostgreSQL]$ ls
libzstd-1.5.2-1.el7.x86_64.rpm                    postgresql15-devel-15.8-1PGDG.rhel7.x86_64.rpm    postgresql15-server-15.8-1PGDG.rhel7.x86_64.rpm
postgresql15-15.8-1PGDG.rhel7.x86_64.rpm          postgresql15-libs-15.8-1PGDG.rhel7.x86_64.rpm
postgresql15-contrib-15.8-1PGDG.rhel7.x86_64.rpm  postgresql15-llvmjit-15.8-1PGDG.rhel7.x86_64.rpm

安装libzstd

[roy@localhost PostgreSQL]$ sudo rpm -ivh libzstd-1.5.2-1.el7.x86_64.rpm
[sudo] password for roy:
Preparing...                          ################################# [100%]
Updating / installing...1:libzstd-1.5.2-1.el7              ################################# [100%]
[roy@localhost PostgreSQL]$ sudo rpm -ivh postgresql15-libs-15.8-1PGDG.rhel7.x86_64.rpm
warning: postgresql15-libs-15.8-1PGDG.rhel7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 73e3b907: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:postgresql15-libs-15.8-1PGDG.rhel################################# [100%]
[roy@localhost PostgreSQL]$ sudo rpm -ivh postgresql15-15.8-1PGDG.rhel7.x86_64.rpm
warning: postgresql15-15.8-1PGDG.rhel7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 73e3b907: NOKEY
error: Failed dependencies:libicu is needed by postgresql15-15.8-1PGDG.rhel7.x86_64

安装libicu

[roy@localhost v16]$ sudo rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm
warning: libicu-50.2-4.el7_7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:libicu-50.2-4.el7_7              ################################# [100%]

安装postgresql15-15.8-1PGDG和postgresql15-server-15.8-1PGDG

[roy@localhost PostgreSQL]$ sudo rpm -ivh postgresql15-15.8-1PGDG.rhel7.x86_64.rpm
warning: postgresql15-15.8-1PGDG.rhel7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 73e3b907: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:postgresql15-15.8-1PGDG.rhel7    ################################# [100%]
[roy@localhost PostgreSQL]$ sudo rpm -ivh postgresql15-server-15.8-1PGDG.rhel7.x86_64.rpm
warning: postgresql15-server-15.8-1PGDG.rhel7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 73e3b907: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:postgresql15-server-15.8-1PGDG.rh################################# [100%]

到/usr/pgsql-15/bin/路径下,初始化服务

[roy@localhost PostgreSQL]$ cd /usr/pgsql-15/bin/
[roy@localhost bin]$ ls
clusterdb   dropdb    pg_archivecleanup  pg_checksums    pg_ctl      pg_isready     pg_restore     pg_test_timing   pg_waldump                  postgresql-15-setup  reindexdb
createdb    dropuser  pg_basebackup      pg_config       pg_dump     pg_receivewal  pg_rewind      pg_upgrade       postgres                    postmaster           vacuumdb
createuser  initdb    pgbench            pg_controldata  pg_dumpall  pg_resetwal    pg_test_fsync  pg_verifybackup  postgresql-15-check-db-dir  psql
[roy@localhost bin]$ postgresql-15-setup initdb
Initializing database ... mkdir: cannot create directory ‘/var/lib/pgsql’: Permission denied
failed, see /var/lib/pgsql/15/initdb.log[roy@localhost bin]$ sudo postgresql-15-setup initdb
Initializing database ... OK

启动服务

systemctl enable postgresql-15  -- 设置为开机自启动systemctl start postgresql-15

在这里插入图片描述

查看服务状态
在这里插入图片描述

进入 /var/lib/pgsql/15/data/ 目录,更改pg_hba.conf 配置

在IP4 下增加

host    all            all            0.0.0.0/0            scram-sha-256

更改postgresql.conf 配置,开启如下配置

listen_addresses = '*'
port = 5432
[roy@localhost bin]$ sudo ls /var/lib/pgsql/15/data/
base              global  pg_commit_ts  pg_hba.conf    pg_logical    pg_notify    pg_serial     pg_stat      pg_subtrans  pg_twophase  pg_wal   postgresql.auto.conf  postmaster.opts
current_logfiles  log     pg_dynshmem   pg_ident.conf  pg_multixact  pg_replslot  pg_snapshots  pg_stat_tmp  pg_tblspc    PG_VERSION   pg_xact  postgresql.conf       postmaster.pid
[roy@localhost bin]$ sudo vi /var/lib/pgsql/15/data/pg_hba.conf
[roy@localhost bin]$ sudo vi /var/lib/pgsql/15/data/postgresql.conf

重启服务

systemctl restart postgresql-15  -- 重启

开放端口

firewall-cmd --permanent --add-port=5432/tcpfirewall-cmd --reload

修改密码

要找出 postgres 用户的密码,您可以尝试以下方法:

1. 默认密码

在很多情况下,PostgreSQL 的默认用户(postgres)没有设置密码。如果您是通过包管理器安装的 PostgreSQL,通常可以直接使用:

su - postgres

进入 postgres 用户后,可以在 PostgreSQL 命令行界面中设置密码。

2. 重置密码

如果您不知道密码,可以通过以下步骤重置它:

  1. 切换至 postgres 用户

    sudo su - postgres
    

    如果没有 sudo 权限,您可能需要先用 root 用户登录。

  2. 进入 PostgreSQL 命令行界面 ,修改密码

ALTER USER postgres WITH PASSWORD '123456'; 

在这里插入图片描述

然后输入新的密码。

  1. 退出 psql

    \q
    

重启服务

完成。

安装timescaledb

安装timescaledb是针对某一个数据库的,单独的数据库要专门创建timescaledb扩展。但是都是要先安装timescaledb服务

安装timescaledb服务

在上面方式二的步骤安装postgres之后就可以直接安装。没有出现依赖问题。

[roy@localhost PostgreSQL]$ sudo rpm -ivh timescaledb_15-2.10.0-1.rhel7.x86_64.rpm
[sudo] password for roy:
warning: timescaledb_15-2.10.0-1.rhel7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 73e3b907: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...1:timescaledb_15-2.10.0-1.rhel7    ################################# [100%]

更改postgresql.conf 配置,开启如下配置

shared_preload_libraries = 'timescaledb'

重启服务

systemctl restart postgresql-15  -- 重启

测试的话,先可以给postgres数据库创建

  1. 切换到postgres用户
 sudo su - postgres

在这里插入图片描述
增加扩展

CREATE EXTENSION IF NOT EXISTS timescaledb;

出现下图代表扩展成功。
在这里插入图片描述

参考:CentOS 7离线安装Postgresql15.2+Timescaledb

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

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

相关文章

MyBatis xml 文件中 SQL 语句的小于号未转义导致报错

问题现象 在 MyBatis 的 xml 文件中添加了一个 SQL 语句 <select id"countXxx" resultType"int">select count(*) from t1 where count < 3 </select>启动 Spring Boot 应用程序后报错&#xff1a; Caused by: org.apache.ibatis.builde…

深入剖析输入URL按下回车,浏览器做了什么

DNS 查询 首先,是去寻找页面资源的位置。如果导航到https://example.com, 假设HTML页面被定位到IP地址为93.184.216.34 的服务器。如果以前没有访问过这个网站&#xff0c;就需要进行DNS查询。 浏览器向域名服务器发起DNS查询请求&#xff0c;最终得到一个IP地址。第一次请求…

Hutool-Java工具库

日期时间 1、DateUtil 获取当前时间 import cn.hutool.core.date.DateUtil;import java.util.Calendar; import java.util.Date; //当前时间字符串&#xff0c;格式&#xff1a;yyyy-MM-dd HH:mm:ssDate date DateUtil.date();Date date2 DateUtil.date(Calendar.getInstan…

ceph介绍和搭建

1 为什么要使用ceph存储 什么是对象存储&#xff1f; 对象存储并没有向文件系统那样划分为元数据区域和数据区域&#xff0c;而是按照不同的对象进行存储&#xff0c;而且每个对象内部维护着元数据和数据区域。因此每个对象都有自己独立的管理格式。 对象存储优点&#xff1a…

BootStrap复选框多选,页面初始化选中处理

以isExecuted字段为例数据库设置为varchar类型 新增页面 <div class"row"><div class"col-sm-6"><div class"form-group"><label class"col-sm-4 control-label">部门协调&#xff1a;</label><di…

这些场景不适合用Selenium自动化!看看你踩过哪些坑?

Selenium是自动化测试中的一大主力工具&#xff0c;其强大的网页UI自动化能力&#xff0c;让测试人员可以轻松模拟用户操作并验证系统行为。然而&#xff0c;Selenium并非万能&#xff0c;尤其是在某些特定场景下&#xff0c;可能并不适合用来自动化测试。本文将介绍Selenium不…

AI大模型在尽职调查中的应用场景与客户案例

应用场景 1. 企业IPO尽职调查中的文档处理与合规审查 在券商投行进行企业IPO尽职调查过程中&#xff0c;企业需要提交大量的财务报表、历史沿革文件、法律合同等资料。这些文件涉及多个部门&#xff0c;往往存在信息分散、合规性复杂、数据量庞大等问题。思通数科的AI能力平…

react-router-dom 库作用

react-router-dom是一个用于在 React 应用中实现路由功能的重要库 一、实现页面导航 1. 声明式路由定义 1.1 基本原理 使用react-router-dom可以在代码中直接定义一个路由规则&#xff0c;如从/home路径导航到Home组件。 1.2 代码示例 Router 路由根容器&#xff0c;Rout…

[C++]内联函数和nullptr

> &#x1f343; 本系列为初阶C的内容&#xff0c;如果感兴趣&#xff0c;欢迎订阅&#x1f6a9; > &#x1f38a;个人主页:[小编的个人主页])小编的个人主页 > &#x1f380; &#x1f389;欢迎大家点赞&#x1f44d;收藏⭐文章 > ✌️ &#x1f91e; &#x1…

15分钟学 Go 实战项目三 : 实时聊天室(学习WebSocket并发处理)

实时聊天室&#xff1a;学习WebSocket并发处理 目标概述 在本项目中&#xff0c;我们将创建一个实时聊天室&#xff0c;使用Go语言和WebSocket来处理并发消息交流。这将帮助你深入理解WebSocket协议的工作原理以及如何在Go中实现并发处理。 1. 项目需求 功能需求 用户可以…

thinkphp6 使用workerman扩展开发tcp应用

代码 <?phpnamespace app\shop\controller;use think\worker\Server;class Tcp extends Server {protected $socket tcp://127.0.0.1:12345;protected $option [name > "order_tcp",count > 1,pidFile > worker.pid, // daemonize > true,…

工业4.0时代下的人工智能新发展

摘要&#xff1a;随着德国工业4.0时代以及中国制造2025的提出&#xff0c;工业智能化的改革的时代正逐渐到来&#xff0c;然而我国整体工业水平仍然处于工业2.0水平。围绕工业4.0中智能工厂、智能生产、智能物流这三大主题&#xff0c;结合国内外研究现状&#xff0c;对人工智能…

一步一步从asp.net core mvc中访问asp.net core WebApi

"从asp.net core mvc中访问asp.net core WebApi"看到这个标题是不是觉得很绕口啊&#xff0c;但的确就是要讲一讲这样的访问。前面我们介绍了微信小程序访问asp.net core webapi(感兴趣的童鞋可以看看前面的博文有关WEBAPI的搭建)&#xff0c;这里我们重点不关心如何…

【Python】关于python中overload装饰器详解

Python不像C、Java等语言可以进行函数的重载。Python是不可以进行函数重载的。下面的例子&#xff0c;虽然我们定义了三个test函数&#xff0c;但是在局部命名空间下&#xff0c;只有一个test函数&#xff0c;就是最有一个&#xff0c;也就是说最后一个test覆盖了前两个test。 …

Qt 获取当前系统中连接的所有USB设备的信息 lsusb版

Qt 获取当前系统中连接的所有USB设备的信息 lsusb版 flyfish 环境 Ubuntu22.04 Qt 6.2.4 实现的功能 枚举USB设备&#xff1a;使用lsusb命令获取当前系统中连接的所有USB设备的信息。 解析设备信息&#xff1a;将lsusb命令的输出按行分割&#xff0c;并提取每行中的总线号、…

使用git进行多人协作开发项目流程

使用git进行多人协作开发项目流程 当然&#xff0c;以下是一个整合了分支管理、Pull Request流程以及日常Git操作的完整GitHub多人协作开发教程。这个教程将从仓库的创建和设置开始&#xff0c;一直到开发流程和最终的代码合并&#xff0c;形成一个完整的工作流程。 完整的Gi…

[面试]Mysql的锁机制

一、锁的基本概念 MySQL中的锁主要用于控制多个事务对数据库资源的并发访问&#xff0c;以确保数据的一致性和完整性。锁机制是数据库并发控制的核心&#xff0c;通过锁定数据库中的资源来防止并发操作引发的数据冲突。 二、锁的分类 MySQL的锁按照作用范围可以分为表级锁和行…

计算2000-2100年,阳历11月11日,与阴历10月1日重叠的年份

# 计算2000-2100年&#xff0c;阳历11月11日&#xff0c;与阴历10月1日重叠的年份from datetime import datetime from lunardate import LunarDatedef find_matching_years(start_year, end_year):matching_years []for year in range(start_year, end_year 1):solar_date …

JVM学习之路(5)垃圾回收

目录 Java垃圾回收 方法区回收 方法区的回收 堆内存回收 引用计数法和可达性分析算法 查看GC Root 五种对象引用 软引用 ​编辑 弱引用 虚引用和终结器引用 垃圾回收算法&#xff1a; 垃圾回收算法的历史和分类 垃圾回收算法的评价标准 标记清除算法 复制算法 标记整理算法 分代…

ubuntu 20.04 NVIDIA驱动、cuda、cuDNN安装

1. NVIDIA驱动 系统设置->软件和更新->附加驱动->选择NVIDIA驱动->应用更改。该界面会自动根据电脑上的GPU显示推荐的NVIDIA显卡驱动。 运行nvidia-smi: NVIDIA-SMI has failed because it couldnt communicate with the NVIDIA driver. Make sure that the lat…