In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
PostgreSQL has a built-in UUID type, but the default installation does not come with related functions and needs to be generated manually.
1. If it is a separate package, the installation method is as follows
Download the software package to the website mentioned in my previous blog
1. Master node:
Install postgresql94-contrib
# yum install postgresql94-contrib-9.4.18-1PGDG.rhel6.x86_64.rpm-y
# find /-name uuid-ossp*
/ usr/pgsql-9.4/lib/uuid-ossp.so
/ usr/pgsql-9.4/share/extension/uuid-ossp--unpackaged--1.0.sql
/ usr/pgsql-9.4/share/extension/uuid-ossp.control
/ usr/pgsql-9.4/share/extension/uuid-ossp--1.0.sql
Log into the database
# su postgres
Bash-4.1$ psql
Execute the following statement
Postgres=# create extension "uuid-ossp"
CREATE EXTENSION
Try to generate a UUID with the imported function
Postgres=# select uuid_generate_v4 ()
Uuid_generate_v4
-
28cbfa1e-d659-4aa2-a0fd-95fc7ec0aa8b
(1 row)
2. Slave node
# su postgres
Bash-4.1$ psql
The package needs to be installed, but the corresponding statements do not need to be executed
# yum install postgresql94-contrib-9.4.18-1PGDG.rhel6.x86_64.rpm-y
# su postgres
Bash-4.1$ psql
Postgres=# select uuid_generate_v4 ()
Uuid_generate_v4
-
88dd0f5e-0011-4471-9b95-008f24852b5b
(1 row)
2. The installation process through yum is as follows
Primary node:
Install the package
# yum install postgresql-contrib
Other processes are the same as above
Matters needing attention
The above process is to operate on the database postgres database created by default. If you want other databases belonging to ordinary users to use the uuid function, you must operate on their databases.
First log in to the database using the super account (the database pgdata operation user is pgone)
Bash-4.1$ psql-U postgres-d pgdata-W
Peimsm=# create extension "uuid-ossp"
CREATE EXTENSION
Peimsm=# select uuid_generate_v4 ()
Uuid_generate_v4
-
0533a1cb-085e-49f6-a451-1508e6051e4a
(1 row)
The above operation only needs to be done on the master node, and the read-only database cannot execute the corresponding statement.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.