当前位置: 首页 > news >正文

(八)PostgreSQL的数据库管理

PostgreSQL的数据库管理

基础信息
OS版本:Red Hat Enterprise Linux Server release 7.9 (Maipo)
DB版本:16.2
pg软件目录:/home/pg16/soft
pg数据目录:/home/pg16/data
端口:5777

1 创建数据库

CREATE DATABASE创建一个新的PostgreSQL数据库。 
若要创建数据库,您必须是超级用户或具有特殊的CREATEDB权限。请参阅CREATE ROLE部分内容。 
默认情况下,将通过克隆系统数据库template1来创建新数据库。也可以通过参数 template 来指定不同的模板。特别是,通过指定TEMPLATE template0,可以创建一个原始数据库(其中不存在用户定义的对象,并且系统对象没有更改),其中只包含PostgreSQL版本预定义的标准对象。这样可以避免复制任何可能已添加到template1中的本地对象。

语法

CREATE DATABASE name
[ WITH ] [ OWNER [=] user_name ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ STRATEGY [=] strategy ] ]
[ LOCALE [=] locale ]
[ LC_COLLATE [=] lc_collate ]
[ LC_CTYPE [=] lc_ctype ]
[ ICU_LOCALE [=] icu_locale ]
[ ICU_RULES [=] icu_rules ]
[ LOCALE_PROVIDER [=] locale_provider ]
[ COLLATION_VERSION = collation_version ]
[ TABLESPACE [=] tablespace_name ]
[ ALLOW_CONNECTIONS [=] allowconn ]
[ CONNECTION LIMIT [=] connlimit ]
[ IS_TEMPLATE [=] istemplate ]
[ OID [=] oid ]

参数解析

  • name
    The name of a database to create.
    要创建的数据库的名称。

  • user_name
    The role name of the user who will own the new database, or DEFAULT to use the default (namely, the user executing the command). To create a database owned by another role, you must be able to SET ROLE to that role.
    将拥有新数据库的用户的角色名称,或使用默认值的DEFAULT(即执行命令的用户)。若要创建由另一个角色拥有的数据库,您必须能够将角色设置为该角色。

  • template
    The name of the template from which to create the new database, or DEFAULT to use the default template (template1).
    用于创建新数据库的模板的名称,或使用默认模板 template1。

  • encoding
    Character set encoding to use in the new database. Specify a string constant (e.g.,
    ‘SQL_ASCII’), or an integer encoding number, or DEFAULT to use the default encoding (namely, the encoding of the template database). The character sets supported by the PostgreSQL server
    are described in Section 24.3.1. See below for additional restrictions.
    要在新数据库中使用的字符集编码。指定字符串常量(例如“SQL_ASCII”)、整数编码数字或使用默认编码(即模板数据库的编码)。PostgreSQL服务器支持的字符集如第24.3.1节所述。有关其他限制,请参见下文。

  • strategy
    Strategy to be used in creating the new database. If the WAL_LOG strategy is used, the database
    will be copied block by block and each block will be separately written to the write-ahead log.
    This is the most efficient strategy in cases where the template database is small, and therefore it is
    the default. The older FILE_COPY strategy is also available. This strategy writes a small record
    to the write-ahead log for each tablespace used by the target database. Each such record represents copying an entire directory to a new location at the filesystem level. While this does reduce the write-ahead log volume substantially, especially if the template database is large, it also forces the system to perform a checkpoint both before and after the creation of the new database. In some situations, this may have a noticeable negative impact on overall system performance.
    用于创建新数据库的策略。如果使用WAL_LOG策略,数据库将被逐块复制,并且每个块将分别写入预写日志。在模板数据库很小的情况下,这是最有效的策略,因此它是默认的。旧的FILE_COPY策略也可用。此策略为目标数据库使用的每个表空间向预写日志中写入一条小记录。每个这样的记录都表示将整个目录复制到文件系统级别的新位置。虽然这确实大大减少了预写日志量,特别是在模板数据库很大的情况下,但它也迫使系统在创建新数据库之前和之后执行检查点。在某些情况下,这可能会对整个系统性能产生明显的负面影响。

  • locale
    Sets the default collation order and character classification in the new database. Collation affects the sort order applied to strings, e.g., in queries with ORDER BY, as well as the order used in indexes on text columns. Character classification affects the categorization of characters, e.g., lower, upper, and digit. Also sets the associated aspects of the operating system environment, LC_COLLATE and LC_CTYPE. The default is the same setting as the template database. See Section 24.2.2.3.1 and Section 24.2.2.3.2 for details.
    设置新数据库中的默认排序规则顺序和字符分类。排序规则影响应用于字符串的排序顺序,例如,在使用order BY的查询中,以及在文本列的索引中使用的顺序。字符分类会影响字符的分类,例如低位、高位和数字。还设置操作系统环境的相关方面LC_COLLATE和LC_CTYPE。默认设置与模板数据库的设置相同。详见第24.2.2.3.1节和第24.2.2.3.2节。

  • lc_collate
    Sets LC_COLLATE in the database server’s operating system environment. The default is the
    setting of locale if specified, otherwise the same setting as the template database. See below
    for additional restrictions.
    If locale_provider is libc, also sets the default collation order to use in the new database,
    overriding the setting locale.
    在数据库服务器的操作系统环境中设置LC_COLLATE。默认值是区域设置(如果指定),否则与模板数据库的设置相同。有关其他限制,请参见下文。
    如果locale_provider是libc,还将设置要在新数据库中使用的默认排序规则顺序,覆盖设置区域设置。

  • lc_ctype
    Sets LC_CTYPE in the database server’s operating system environment. The default is the setting of locale if specified, otherwise the same setting as the template database. See below for additional restrictions.
    If locale_provider is libc, also sets the default character classification to use in the new database, overriding the setting locale.
    在数据库服务器的操作系统环境中设置LC_CTYPE。默认值是区域设置(如果指定),否则与模板数据库的设置相同。有关其他限制,请参见下文。
    如果locale_provider是libc,还将设置要在新数据库中使用的默认字符分类,从而覆盖设置区域设置。

  • icu_locale
    Specifies the ICU locale (see Section 24.2.2.3.2) for the database default collation order and character classification, overriding the setting locale. The locale provider must be ICU. The default is the setting of locale if specified; otherwise the same setting as the template database.
    为数据库默认排序规则顺序和字符分类指定ICU区域设置(请参见第24.2.2.3.2节),覆盖设置区域设置。区域设置提供程序必须是ICU。如果指定,则默认为区域设置;否则设置与模板数据库相同

  • icu_rules
    Specifies additional collation rules to customize the behavior of the default collation of this database. This is supported for ICU only. See Section 24.2.3.4 for details.
    指定其他排序规则以自定义此数据库的默认排序规则的行为。这仅适用于ICU。详见第24.2.3.4节。

  • locale_provider
    Specifies the provider to use for the default collation in this database. Possible values are icu (if the server was built with ICU support) or libc. By default, the provider is the same as that of
    the template. See Section 24.1.4 for details.
    指定用于此数据库中默认排序规则的提供程序。可能的值是icu(如果服务器是在icu支持下构建的)或libc。默认情况下,提供程序与模板的提供程序相同。详见第24.1.4节。

  • collation_version
    Specifies the collation version string to store with the database. Normally, this should be omitted, which will cause the version to be computed from the actual version of the database collation as provided by the operating system. This option is intended to be used by pg_upgrade for copying the version from an existing installation.
    See also ALTER DATABASE for how to handle database collation version mismatches.
    指定要与数据库一起存储的排序规则版本字符串。通常情况下,应该忽略这一点,这将导致根据操作系统提供的数据库排序规则的实际版本来计算版本。此选项用于pg_upgrade从现有安装中复制版本。
    有关如何处理数据库排序规则版本不匹配的信息,请参阅ALTER DATABASE。

  • tablespace_name
    The name of the tablespace that will be associated with the new database, or DEFAULT to use
    the template database’s tablespace. This tablespace will be the default tablespace used for objects created in this database. See CREATE TABLESPACE for more information.
    将与新数据库相关联的表空间的名称,或默认使用模板数据库表空间。此表空间将是用于在此数据库中创建的对象的默认表空间。有关详细信息,请参见CREATE TABLESPACE。

  • allowconn
    If false then no one can connect to this database. The default is true, allowing connections (except as restricted by other mechanisms, such as GRANT/REVOKE CONNECT).
    如果为false,则没有人可以连接到此数据库。默认值为true,允许连接(除非受到其他机制的限制,如GRANT/REVOKE CONNECT)。

  • connlimit
    How many concurrent connections can be made to this database. -1 (the default) means no limit.
    可以与此数据库建立多少个并发连接-1(默认值)表示没有限制。

  • istemplate
    If true, then this database can be cloned by any user with CREATEDB privileges; if false (the
    default), then only superusers or the owner of the database can clone it.
    如果为true,则任何具有CREATEDB权限的用户都可以克隆此数据库;如果为false(默认值),则只有超级用户或数据库所有者才能克隆它。

  • oid
    The object identifier to be used for the new database. If this parameter is not specified, PostgreSQL will choose a suitable OID automatically. This parameter is primarily intended for internal use by pg_upgrade, and only pg_upgrade can specify a value less than 16384.
    要用于新数据库的对象标识符。如果没有指定这个参数,PostgreSQL会自动选择一个合适的OID。此参数主要供pg_upgrade内部使用,只有pg_upggrade才能指定小于16384的值。

Optional parameters can be written in any order, not only the order illustrated above.
以上可选参数可以按照任何顺序写入,而不仅仅是按照上面所示的顺序。

case 1:创建数据库test1

postgres=# create database test1;
CREATE DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(5 rows)

case 2:创建数据库test2,并指定表空间。

--创建表空间test1
mkdir -p /pgdir/test1
chown -R pg16:pg16  /pgdir/test1[pg16@test test1]$ psql -p 5777
psql (16.2)
Type "help" for help.postgres=# CREATE TABLESPACE test1 LOCATION '/pgdir/test1';
CREATE TABLESPACE
postgres=# \dbList of tablespacesName    |  Owner   |   Location   
------------+----------+--------------pg_default | postgres | pg_global  | postgres | test1      | postgres | /pgdir/test1
(3 rows)

–创建数据库test2

postgres=# create database test2 tablespace test1;
CREATE DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)postgres=# select b.datname,a.spcname from pg_tablespace a,pg_database b where a.oid=b.dattablespace and b.datname='test2';datname | spcname 
---------+---------test2   | test1
(1 row)

2 修改数据库

语法

ALTER DATABASE name [ [ WITH ] option [ ... ] ]
where option can be:
ALLOW_CONNECTIONS allowconn
CONNECTION LIMIT connlimit
IS_TEMPLATE istemplate
ALTER DATABASE name RENAME TO new_name
ALTER DATABASE name OWNER TO { new_owner | CURRENT_ROLE |
CURRENT_USER | SESSION_USER }
ALTER DATABASE name SET TABLESPACE new_tablespace
ALTER DATABASE name REFRESH COLLATION VERSION
ALTER DATABASE name SET configuration_parameter { TO | = } { value
| DEFAULT }
ALTER DATABASE name SET configuration_parameter FROM CURRENT
ALTER DATABASE name RESET configuration_parameter
ALTER DATABASE name RESET ALL

参数解析

  • name
    The name of the database whose attributes are to be altered.

  • allowconn
    If false then no one can connect to this database.

  • connlimit
    How many concurrent connections can be made to this database. -1 means no limit.

  • istemplate
    If true, then this database can be cloned by any user with CREATEDB privileges; if false, then
    only superusers or the owner of the database can clone it.

  • new_name
    The new name of the database.

  • new_owner
    The new owner of the database.

  • new_tablespace
    The new default tablespace of the database.
    This form of the command cannot be executed inside a transaction block.

  • REFRESH COLLATION VERSION
    Update the database collation version. See Notes for background.

  • configuration_parameter

  • value
    Set this database’s session default for the specified configuration parameter to the given value. Ifvalue is DEFAULT or, equivalently, RESET is used, the database-specific setting is removed,
    so the system-wide default setting will be inherited in new sessions. Use RESET ALL to clear
    all database-specific settings. SET FROM CURRENT saves the session’s current value of the
    parameter as the database-specific value.

case 1:数据库test1的表空间为test1

postgres=# select b.datname,a.spcname from pg_tablespace a,pg_database b where a.oid=b.dattablespace and b.datname='test1';datname |  spcname   
---------+------------test1   | pg_default
(1 row)postgres=# alter database test1 set tablespace test1;
ALTER DATABASE
postgres=# select b.datname,a.spcname from pg_tablespace a,pg_database b where a.oid=b.dattablespace and b.datname='test1';datname | spcname 
---------+---------test1   | test1
(1 row)postgres=# 

case 2:修改数据库test1的名字为test1_new

postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)postgres=# alter database test1 rename to test1_new;
ALTER DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1_new | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)

3 删除数据库

DROP DATABASE删除数据库。它删除数据库的目录条目,并删除包含数据的目录。它只能由数据库所有者执行。当您连接到目标数据库时,它无法执行。(连接到postgres或任何其他数据库以发出此命令。)此外,如果其他任何人连接到目标数据库,则除非使用下面描述的FORCE选项,否则此命令将失败。
DROP DATABASE无法撤消。小心使用!

语法

DROP DATABASE [ IF EXISTS ] name [ [ WITH ] ( option [, ...] ) ]
where option can be:
FORCE

case 1:删除数据库test1

postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest1     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | test2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(6 rows)postgres=# drop database test1;
DROP DATABASE
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestest2     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | white     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(5 rows)

case 2:删除数据库test2,加force参数。

postgres=# drop database test2;
ERROR:  database "test2" is being accessed by other users
DETAIL:  There is 1 other session using the database.^
postgres=# drop database test2 with (force);
DROP DATABASE
postgres=# 
postgres=# \lList of databasesName    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | ICU Locale | ICU Rules |   Access privileges   
-----------+----------+----------+-----------------+-------------+-------------+------------+-----------+-----------------------postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgrestemplate1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | =c/postgres          +|          |          |                 |             |             |            |           | postgres=CTc/postgreswhite     | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |            |           | 
(4 rows)postgres=# 

更多内容请查看对应数据库版本的官方文档。

谨记:心存敬畏,行有所止。

相关文章:

(八)PostgreSQL的数据库管理

PostgreSQL的数据库管理 基础信息 OS版本:Red Hat Enterprise Linux Server release 7.9 (Maipo) DB版本:16.2 pg软件目录:/home/pg16/soft pg数据目录:/home/pg16/data 端口:57771 创建数据库 CREATE DATABASE创建一…...

外包干了30天,技术倒退明显

先说情况,大专毕业,18年通过校招进入湖南某软件公司,干了接近6年的功能测试,今年年初,感觉自己不能够在这样下去了,长时间呆在一个舒适的环境会让一个人堕落! 而我已经在一个企业干了四年的功能…...

ruoyi-nbcio-plus基于vue3的flowable的自定义业务单表例子的升级修改

更多ruoyi-nbcio功能请看演示系统 gitee源代码地址 前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio 演示地址:RuoYi-Nbcio后台管理系统 http://122.227.135.243:9666/ 更多nbcio-boot功能请看演示系统 gitee源代码地址 后端代码&#xff1a…...

【ENSP】华为三层交换机配置AAA认证,开启telnet服务

配置步骤 1.给交换机配置ip地址,以便登陆 2.配置AAA,用户名,密码,服务类型,用户权限 3.配置接入设备的数量 4.开启telnet服务 LSW2交换机配置 u t m #关闭提示 sys …...

collections模块下的Counter函数讲解

📚博客主页:knighthood2001 ✨公众号:认知up吧 (目前正在带领大家一起提升认知,感兴趣可以来围观一下) 🎃知识星球:【认知up吧|成长|副业】介绍 ❤️感谢大家点赞👍&…...

HarmonyOS开发实例:【分布式邮件】

概述 基于TS扩展的声明式开发范式编程语言编写的一个分布式邮件系统,可以由一台设备拉起另一台设备,每次改动邮件内容,都会同步更新两台设备的信息。效果图如下: 搭建OpenHarmony开发环境 完成本篇Codelab我们首先要完成开发环境…...

llama2.c与chinese-baby-llama2语言模型本地部署推理

文章目录 简介Github文档克隆源码英文模型编译运行中文模型(280M)main函数 简介 llama2.c是一个极简的Llama 2 LLM全栈工具,使用一个简单的 700 行 C 文件 ( run.c ) 对其进行推理。llama2.c涉及LLM微调、模型构建、推理端末部署&#xff08…...

008、Python+fastapi,第一个后台管理项目走向第8步:ubutun 20.04下安装vscode+python环境配置

一、说明 白飘了3个月无影云电脑,开始选了个windows server 非常不好用,后台改为ubuntu想升级到22,没成功,那就20.04吧。 今天先安装下开发环境,后续2个月就想把他当做开发服务器,不知道行不行,…...

2024.4.16 驱动开发

思维导图...

如何在 Ubuntu 14.04 上更改 PHP 设置

简介 PHP 是一种服务器端脚本语言,被许多流行的 CMS 和博客平台如 WordPress 和 Drupal 所使用。它也是流行的 LAMP 和 LEMP 堆栈的一部分。更新 PHP 配置设置是设置基于 PHP 的网站时的常见任务。定位确切的 PHP 配置文件可能并不容易。通常在服务器上会有多个 PH…...

【光伏企业】光伏项目怎么做才能提高效率?

一、精细化项目管理 项目规划:在项目启动前,进行充分的调研和规划,明确项目的目标、规模、预算和时间表,确保各项资源得到合理分配。 团队建设:组建一支高效、专业的项目团队,确保团队成员具备光伏领域的…...

毕设选51还是stm32?51太简单?

如果你更倾向于挑战和深入学习,STM32可能是更好的选择。如果你希望更专注于底层硬件原理,51可能更适合。我这里有一套嵌入式入门教程,不仅包含了详细的视频讲解,项目实战。如果你渴望学习嵌入式,不妨点个关注&#xff…...

ip addr和ifconfig区别

ip addr和ifconfig都是用于配置和管理网络接口的工具 1. ifconfig ifconfig是较旧的网络配置工具,属于net-tools套件的一部分。 该命令主要用于配置、显示和控制网络接口的参数,如IP地址、子网掩码、广播地址等。 ifconfig命令的功能相对有限&#xff…...

Springboot+Vue项目-基于Java+MySQL的房产销售系统(附源码+演示视频+LW)

大家好!我是程序猿老A,感谢您阅读本文,欢迎一键三连哦。 💞当前专栏:Java毕业设计 精彩专栏推荐👇🏻👇🏻👇🏻 🎀 Python毕业设计 &…...

向量数据库中的向量是什么?

在向量数据库中,向量通常指的是高维空间中的点或方向,它们由一组数值组成,这些数值表示该点在空间中的位置或方向。在机器学习和人工智能领域,向量经常用于表示各种类型的数据,如文本、图像、音频等。 具体来说&#x…...

【重回王座】ChatGPT发布最新模型gpt-4-turbo-2024-04-09

今天,新版GPT-4 Turbo再次在大型模型排行榜上荣登榜首,成功超越了此前领先的Claude 3 Opus。另外,新模型在处理长达64k的上下文时,性能竟能够与旧版在处理26k上下文时的表现相当。 目前GPT-4 Turbo仅限于ChatGPT Plus的用户&…...

NL2SQL基础系列(1):业界顶尖排行榜、权威测评数据集及LLM大模型(Spider vs BIRD)全面对比优劣分析[Text2SQL、Text2DSL]

NL2SQL基础系列(1):业界顶尖排行榜、权威测评数据集及LLM大模型(Spider vs BIRD)全面对比优劣分析[Text2SQL、Text2DSL] Text-to-SQL(或者Text2SQL),顾名思义就是把文本转化为SQL语言,更学术一…...

深度学习基础——计算量、参数量和推理时间

深度学习基础——计算量、参数量和推理时间 在深度学习中,计算量、参数量和推理时间是评估模型性能和效率的重要指标。本文将介绍这三个指标的定义、计算方法以及如何使用Python进行实现和可视化展示,以帮助读者更好地理解和评估深度学习模型。 1. 定义…...

另一棵树的子树

目录 题目 思路 代码1 :相同的树 代码二:解题 注意点 题目 给你两棵二叉树 root 和 subRoot 。检验 root 中是否包含和 subRoot 具有相同结构和节点值的子树。如果存在,返回 true ;否则,返回 false 。 二叉树 tr…...

【hive】单节点搭建hadoop和hive

一、背景 需要使用hive远程debug,尝试使用无hadoop部署hive方式一直失败,无果,还是使用有hadoop方式。最终查看linux内存占用6GB,还在后台运行docker的mysql(bitnami/mysql:8.0),基本满意。 版本选择: &a…...

Aurora 协议学习理解与应用——Aurora 8B10B协议学习

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 Aurora 8B10B协议学习之一,理解协议 概述8B10B数据发送和接收Symbol-Pairs传输调度用户PDU传输过程用户PDU接收过程 流控自然流量控制操作自然流量控制延迟自然流…...

Vue基础使用之V-Model绑定单选、复选、动态渲染选项的值

这里要说明一下&#xff0c;在v-model 绑定的值是id还是value是和<option>中的v-bind保持一致的&#xff0c;如第四个&#xff0c;如果是 <option :value"op[1]" 那v-model绑定的就是数组第二项的值2&#xff0c;4&#xff0c;6 如果是 <option :va…...

分析ARP解析过程

1、实验环境 主机A和主机B连接到交换机&#xff0c;并与一台路由器互连&#xff0c;如图7.17所示&#xff0c;路由器充当网关。 图7.17 实验案例一示意图 2、需求描述 查看 ARP 相关信息,熟悉在PC 和 Cisco 设备上的常用命令,设置主机A和主机B为同一个网段网关设置为路由接…...

为硬刚小米SU7,华为智界S7整出了「梅开二度」操作

如今国产中大型新能源轿车市场&#xff0c;在小米 SU7 加入后&#xff0c;可算彻底活了过来。 过去几年&#xff0c;咱们自主新能源品牌在 20-30 万元级轿车上发力明显不足&#xff0c;老牌车厂比亚迪汉几乎以一己之力扛起销量担当。 随着新能源汽车消费升级、竞争加剧&#x…...

408数据结构,怎么练习算法大题?

其实考研的数据结构算法题是有得分技巧的 得分要点 会写结构定义&#xff08;没有就自己写上&#xff09;写清楚解题的算法思想描述清楚算法实现最后写出时间和空间复杂度 以上这四步是完成一道算法题的基本步骤&#xff0c;也是其中得分的主要地方就是后面两步。但是前面两…...

imgcat 工具

如果经常在远程服务器或嵌入式设备中操作图片&#xff0c;要查看图片效果&#xff0c;就要先把图片dump到本地&#xff0c;比较麻烦。可以使用这个工具&#xff0c;直接在终端上显示。类似于这种效果。 imgcat 是一个终端工具&#xff0c;使用 iTerm2 内置的特性&#xff0c;允…...

Anaconda换清华源

1. 查看conda配置文件 sudo vim ~/.condarc2. 删除~/.condarc文件内容 使用vim中的dd命令 3. 打开并复制清华源的地址粘贴到~/.condarc文件中 https://mirrors4.tuna.tsinghua.edu.cn/help/anaconda/ channels:- defaults show_channel_urls: true default_channels:- https…...

react使用npm i @reduxjs/toolkit react-redux

npm i reduxjs/toolkit react-redux 创建一个 store文件夹&#xff0c;里面创建index.js文件和子模块文件夹 index,js文件写入以下代码 import {configureStore} from reduxjs/toolkit // 导入子模块 import counterReducer from ./modules/one import two from ./modules/tw…...

Nessus【部署 03】Docker部署漏洞扫描工具Nessus详细过程分享(下载+安装+注册+激活)文末福利

Docker部署漏洞扫描工具Nessus 1.安装2.配置2.1 添加用户2.2 获取Challenge code2.3 获取插件和许可证2.4 注册 3.使用4.进阶 整体流程&#xff1a; 1.安装 # 1.查询镜像 docker search nessus# 2.拉取镜像 docker pull tenableofficial/nessus# 3.启动镜像【挂载目录用于放置…...

2023年看雪安全技术峰会(公开)PPT合集(11份)

2023年看雪安全技术峰会&#xff08;公开&#xff09;PPT合集&#xff0c;共11份&#xff0c;供大家学习参阅。 1、MaginotDNS攻击&#xff1a;绕过DNS 缓存防御的马奇诺防线 2、从形式逻辑计算到神经计算&#xff1a;针对LLM角色扮演攻击的威胁分析以及防御实践 3、TheDog、0…...

还有哪些媲美wordpress框架/百度推广入口登录

前言 昨天XY讲课&#xff01;讲到这题&#xff01;还是IOI的题&#xff01;不过据说00年的时候DP还不流行。 题面 http://poj.org/problem?id1160 分析 1 中位数 首先我们考虑&#xff0c;若有x1 < x2 < ... < xn&#xff0c;则当∑abs(x - xi)最小时&#xff0c;x为…...

腾宁科技做网站399元全包/如何做seo搜索引擎优化

Java 设计模式 Prototype 原型 模式 Prototype 模式用于不能根据类来来生产实例时&#xff0c;而根据现有的实例来生成新的实例。 原型&#xff1a;负责定义用于复制现有实例来生成新实例的方法。具体的原型&#xff1a;负责实现复制现有实例并生成新实例的方法。使用者&#x…...

北京网站设计工资多少/国家职业技能培训学校

基于Python--opencv的人脸识别 环境配置安装python3.7 配置pip 下载环境安装第三方包# pip install 第三方包 -i https://pypi.tuna.tsinghua.edu.cn/simple 使用清华镜像源加快速度# pillow的安装&#xff0c;输入&#xff1a; pip install pillow -i https://pypi.tuna.tsing…...

阿里云建设网站步骤/优秀的软文

很多用源码编译安装和一些用tar包直接解压缩的java程序都没有init脚本&#xff0c;不能像httpd或者nginx这种服务直接使用service httpd start&#xff0c;也不能使用/etc/init.d/httpd start 来启动。对于这种情况&#xff0c;我们可以自己写一个init脚本&#xff0c;并将命令…...

广告平面设计基础知识/嘉兴seo优化

Vue——插槽 一、插槽的基本使用 插槽的作用&#xff1a; Vue插槽是Vue中常见的一种组件间的相互通信方式&#xff0c;作用是让父组件可以向子组件指定位置插入html结构&#xff0c;适用于父组件>子组件&#xff0c;在要接收数据的组件页面通过<slot>标签来表示&am…...

在那里做网站/企业网址搭建

题目连接 题目大意 给你一个01串&#xff0c;要你用最少的变化次数使得所有的1相邻的距离为k。变化的方式为1->0,0->1.要你求最少的变化次数 题目思路 emm完全没啥思路&#xff0c;看了题解&#xff0c;其实就是你要想这些数字1都是modk等于一个定值&#xff0c;那么…...