YuKon2.0 测试

一、产品安装

1.1 下载解压

下载请官网下载或联系相关人员获取

解压后如下图所示,是基于不同操作系统和PostgreSQL和OPENGAUSS下的禹贡数据库安装包。
在这里插入图片描述

1.2 安装openGauss

此次测试以openGAUSS包为基础进行测试
openGAUSS安装可参考官网https://docs.opengauss.org/zh/docs/2.0.1/docs/installation/installation.html

1.2.1 安装前准备

创建普通用户,openGauss安装要求普通用户安装

[root@yukon /]# useradd omm
[root@yukon /]# passwd omm

关闭防火墙

[root@yukon /]# systemctl stop firewalld.service 
[root@yukon /]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

修改SELINUX

[root@yukon /]# vim /etc/selinux/config 
[root@yukon /]# more /etc/selinux/config 
SELINUX=disabled

重启服务器

[root@yukon /]# reboot

1.2.2 安装

解压

[omm@yukon openGauss]$ tar -jxf openGauss-5.0.0-CentOS-64bit.tar.bz2 -C /opt/openGauss/openGauss
[omm@yukon openGauss]$ ls
bin  etc  include  jre  lib  share  simpleInstall  version.cfg

安装

[omm@yukon openGauss]$ cd simpleInstall/
[omm@yukon simpleInstall]$ ls
finance.sql  install.sh  README.md  school.sql

# -w:初始化数据库密码(gs_initdb指定),安全需要必须设置。
# -p:指定的openGauss端口号, 如不指定,默认为5432。
# -h|–help 打印使用说明。
# 安装后,数据库的名称为sgnode。
# 安装后,数据库目录安装路径/opt/software/openGauss/data/single_node,其中/opt/software/openGauss为解压包路径,data/single_node为新创建的数据库节点目录。
[omm@yukon simpleInstall]$ sh install.sh -w supermap11I
[2023-05-17 09:07:27.004][3317][][gs_ctl]: server started (/opt/openGauss/openGauss/data/single_node)
import sql file
Would you like to create a demo database (yes/no)? yes
Load demoDB [school,finance] success.
[complete successfully]: You can start or stop the database server using:
    gs_ctl start|stop|restart -D $GAUSSHOME/data/single_node -Z single_node
# 安装后,数据库目录安装路径/opt/software/openGauss/data/single_node,其中/opt/software/openGauss为解压包路径,data/single_node为新创建的数据库节点目录。

# 安装完成后,默认生成名称为postgres的数据库。第一次连接数据库时可以连接到此数据库。

异常处理

执行时,如果出现报错“the maximum number of SEMMNI is not correct, the current SEMMNI is xxx. Please check it.”,请使用有root权限的用户执行如下命令。

sysctl -w kernel.sem="250 85000 250 330" 

环境变量

# 极简版安装之后需要手动配置环境变量,root用户下,在/etc/profile 最后增加以下内容
[root@localhost opt]$ vim /etc/profile
export GAUSSHOME=/opt/openGauss/openGauss
export PGDATA=$GAUSSHOME/data/single_node
export PATH=$PATH:$GAUSSHOME:$PGDATA
# 配置完成之后source使环境生效
[root@localhost opt]$ source /etc/profile

检查环境

[omm@localhost opt]$ ps ux | grep openGauss
omm        3435  4.5  9.8 5977128 788684 ?      Ssl  11:04   1:44 /opt/openGauss/openGauss/bin/gaussdb -D /opt/openGauss/openGauss/data/single_node
omm       59379  0.0  0.0 110492   908 pts/2    S+   11:42   0:00 grep --color=auto openGauss

[omm@localhost opt]$ gs_ctl query -D /opt/openGauss/data/single_node
[2023-05-17 11:41:36.646][59238][][gs_ctl]: gs_ctl query ,datadir is /opt/openGauss/data/single_node 
[2023-05-17 11:41:36.647][59238][][gs_ctl]:  PID file "/opt/openGauss/data/single_node/postmaster.pid" does not exist
[2023-05-17 11:41:36.647][59238][][gs_ctl]: Is server running?
[omm@localhost opt]$ gs_ctl query -D /opt/openGauss/openGauss/data/single_node
[2023-05-17 11:41:49.939][59262][][gs_ctl]: gs_ctl query ,datadir is /opt/openGauss/openGauss/data/single_node 
 HA state:           
	local_role                     : Normal
	static_connections             : 0
	db_state                       : Normal
	detail_information             : Normal

 Senders info:       
No information 
 Receiver info:      
No information

1.3 安装yukon数据库

解压数据库

[root@yukon packages]# tar -zxvf openGauss-5.0.0-CentOS-64bit.tar.bz2
[root@yukon openGauss]# cd yukon/
[omm@localhost yukon]$ ls
bin        install.sh  license    Yukon-2.0-Beta产品文档.pdf
extension  lib         proj_data  yukon_dep

执行安装程序

[root@yukon yukon]# sh install.sh -i
开始安装......
pg_config 是 /opt/openGauss/openGauss/bin/pg_config
current directory:  /opt/openGauss/yukon
binary directory:  /opt/openGauss/openGauss/bin
pkglibrary directory:  /opt/openGauss/openGauss/lib/postgresql
extension directory:  /opt/openGauss/openGauss/share/postgresql/extension
yukondep directory:  /opt/openGauss/openGauss/lib
__     __      _                   _____   ____  
\ \   / /     | |                 |  __ \ |  _ \ 
 \ \_/ /_   _ | | __ ___   _ __   | |  | || |_) |
  \   /| | | || |/ // _ \ | '_ \  | |  | ||  _ < 
   | | | |_| ||   <| (_) || | | | | |__| || |_) |
   |_|  \__,_||_|\_\\___/ |_| |_| |_____/ |____/ 

1.4 使用客户端连接

使用默认配置无法在其他客户端直接访问,需要修改以下配置

# 修改postgres.conf
[omm@localhost single_node]$ pwd
/opt/openGauss/openGauss/data/single_node
[omm@localhost single_node]$ vim postgresql.conf
[omm@localhost single_node]$ more postgresql.conf| grep listen
listen_addresses = '*'		# what IP address(es) to listen on;
password_encryption_type = 0  # 修改为0表示md5加密方式
# 修改pg_hba.conf ,增加以下内容
[omm@localhost single_node]$ vim pg_hba.conf 
[omm@localhost single_node]$ more pg_hba.conf | grep md5 
host 	all		all		0.0.0.0/0		md5

重启

[omm@localhost openGauss]$ gs_ctl restart -D $GAUSSHOME/data/single_node  -Z single_node

二、 使用YuKon数据库

2.1 创建用户

[omm@localhost yukon]$ gsql -d postgres
# 创建一个测试用户
openGauss=# CREATE USER yukon with PASSWORD 'Bigdata@123' SYSADMIN ;
CREATE ROLE

2.2 创建扩展

# yukon数据库支持的扩展函数有:  postgis、postgis_raster、postgis_sfcgal、yukon_geomodel、yukon_geogridcoder
create extension postgis;  # 与数据库适配的 PostGIS 矢量模块
create extension postgis_raster;  # 与数据库适配的 PostGIS 栅格模块
create extension postgis_sfcgal; # 与数据库适配的 PostGIS 栅格模块
create extension yukon_geomodel; # 提供对空间三维模型数据的存储和管理
create extension yukon_geogridcoder; # 提供空间网格编码的相关操作,目前支持 GeoSOT 编码。
create extension yukon_vector_pyramid; # 提供矢量金字塔模块

2.3 创建矢量数据

以下示例直接使用的官网文档

-- 创建带geometry列的表
CREATE TABLE global_points (id SERIAL PRIMARY KEY,name VARCHAR(64),location geometry(POINT,3857));

-- 写入10个点对象
INSERT INTO global_points (name, location) VALUES ('Town1', ST_GeomFromEWKT('SRID=3857;POINT (12057531.405152922 4096788.3009192282)') );
INSERT INTO global_points (name, location) VALUES ('Town2', ST_GeomFromEWKT('SRID=3857;POINT (12057879.323089447 4096794.06898925)') );
INSERT INTO global_points (name, location) VALUES ('Town3', ST_GeomFromEWKT('SRID=3857;POINT (12057241.150712628 4096835.404659481)') );
INSERT INTO global_points (name, location) VALUES ('Town4', ST_GeomFromEWKT('SRID=3857;POINT (12057396.37461059 4096885.372392862)') );
INSERT INTO global_points (name, location) VALUES ('Town5', ST_GeomFromEWKT('SRID=3857;POINT (12056940.710538926 4096886.9123589676)') );
INSERT INTO global_points (name, location) VALUES ('Town6', ST_GeomFromEWKT('SRID=3857;POINT (12058128.24460281 4096938.23117457)') );
INSERT INTO global_points (name, location) VALUES ('Town7', ST_GeomFromEWKT('SRID=3857;POINT (12058378.134595742 4097081.4360874156)') );
INSERT INTO global_points (name, location) VALUES ('Town8', ST_GeomFromEWKT('SRID=3857;POINT (12058636.607321415 4097235.1257181372)') );
INSERT INTO global_points (name, location) VALUES ('Town9', ST_GeomFromEWKT('SRID=3857;POINT (12058917.488660585 4097395.7746241256)') );
INSERT INTO global_points (name, location) VALUES ('Town10', ST_GeomFromEWKT('SRID=3857;POINT (12059180.102471316 4097548.7255362184)') );
SELECT * FROM global_points WHERE ST_DWithin(location, ST_GeomFromEWKT('SRID=3857;POINT (12058378 4097081)'), 500);

结果如下:

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

会灭火的程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值