суббота, 20 ноября 2021 г.

postgreSQL function uuid_generate_v4() does not exist

Была ошибка function uuid_generate_v4() does not exist при запуске микросервиса на Go.


Решение:

1. CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

2. \CONNECT my_database

3.  CREATE EXTENSION "uuid-ossp";

PostgreSQL grant access примеры

 1. Grant CONNECT to the database:

GRANT CONNECT ON DATABASE database_name TO username;

2. Grant USAGE on schema:

GRANT USAGE ON SCHEMA schema_name TO username;

3. Grant on all tables for DML statements: SELECT, INSERT, UPDATE, DELETE:

GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA schema_name TO username;

4. Grant all privileges on all tables in the schema:

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema_name TO username;

5. Grant all privileges on all sequences in the schema:

GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA schema_name TO username;

6. Grant all privileges on the database:

GRANT ALL PRIVILEGES ON DATABASE database_name TO username;

7. Grant permission to create database:

ALTER USER username CREATEDB;

8. Make a user superuser:

ALTER USER myuser WITH SUPERUSER;

9. Remove superuser status:

ALTER USER username WITH NOSUPERUSER;

Those statements above only affect the current existing tables. To apply to newly created tables, you need to use alter default. For example:

ALTER DEFAULT PRIVILEGES
FOR USER username
IN SCHEMA schema_name
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO username;

dropdb postgresql удалить базу

 Необходимо было удалить БД в postgreSQL, помогла утитита dropdb.


Пример:

dropdb -h x.x.x.x -U postgres -i -e database_name

вторник, 16 ноября 2021 г.

nmcli статический IP адрес

Необходимо было использовать статический IP в LiveCD RedHat CoreOS.


Решение:


nmcli con mod "Wired connection 1" ipv4.addresses 10.160.1.x/24

nmcli con mod "Wired connection 1" ipv4.gateway 10.160.1.x

nmcli con mod "Wired connection 1" ipv4.dns "10.201.1.x, 10.201.1.x"

nmcli con mod "Wired connection 1" ipv4.method manual 

nmcli conn show