centos7 安装OmniDB 配置nginx proxy 连接oracle

1. 安装OmniDB

下载最新版OmniDB
omnidb-app_2.17.0-centos-amd64.rpm

rpm -ivh omnidb-server_2.17.0-centos7-amd64.rpm

omnidb-server 使用了两个服务来交互,一个是本身的web服务器,还有一个WebSocket服务器。web的默认端口是8000,WebSocket的端口是25482

2. 运行OmniDB

可以直接通过运行

[root@localhost ~]# omnidb-server
Starting OmniDB websocket...
Checking port availability...
Starting websocket server at port 25482.
Starting OmniDB server...
Checking port availability...
Starting server OmniDB 2.17.0 at 127.0.0.1:8000.
Starting migration of user database from version 0.0.0 to version 2.17.0...
OmniDB successfully migrated user database from version 0.0.0 to version 2.17.0
Open OmniDB in your favorite browser
Press Ctrl+C to exit

2.1 配置文件

运行成功之后,会在用户的根目录生成.omnidb,也可以通过-d 指定文件夹,安装成功之后,会生成一个/etc/omnidb.conf文件,如果想使用当前配置文件,需要在启动的时候 -c /etc/omnidb.conf 指定配置文件

# 真正起作用的配置文件
~/.omnidb/omnidb-server/omnidb.conf

配置文件的一些说明

# OmniDB Server configuration file
[webserver]
# 监听对象,如果外网直接访问,需要设置成0.0.0.0 -H -h是帮助  
listening_address    = 127.0.0.1

# web服务启动端口 -p
listening_port       = 8000
# websocket 启动端口,这个端口,有时候被占用的话,最自动切换成别的端口,所以在启动的时候要留意一下 -w
websocket_port       = 25482

# 在web启动的时候,会和服务端建立一个socket连接,有时候不能直接连接25482,通过反向代理,那么就需要使用这个配置, 通过-e实现
# external_websocket_port = 25482

# 下面的都是配置一些ssl的了。
# is_ssl = True requires ssl_certificate_file and ssl_key_file parameters
# This is highly recommended to protect information
is_ssl               = False
ssl_certificate_file = /path/to/cert_file
ssl_key_file         = /path/to/key_file

# Trusted origins, use this parameter if OmniDB is configured with SSL and is being accessed by another domain
csrf_trusted_origins = origin1,origin2,origin3

# 也就是上下文,默认路径是 localhost:8000 加了path=omnidb 之后就变成了localhost:8000/omnidb ,在配置反向代理的时候,用的上
path =

[queryserver]
# 下面就是查询等等一些配置了。
# Max number of threads that can used by each advanced object search request
thread_pool_max_workers = 2

# Number of seconds between each prompt password request. Default: 30 minutes
pwd_timeout_total = 1800

2.2 浏览器访问

输入地址加端口http://192.168.10.91:8000,跳转到登录页面,输入用户名和密码admin/admin进入系统,至此,最基本的功能,可以运行了。
1.添加连接
在这里插入图片描述
2.进行访问查询
在这里插入图片描述

3. 配置反向代理

3.1 nginx 的安装

sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx

3.1 配置反向代理

假设我们配置的nginx location=/omni 那么对应omnidb的配置文件也要进行相应的更改path = /omni

server {
    listen       80;
    server_name  192.168.10.91;
    # 这里面的路径要注意
    location /omni/ws {
        proxy_pass  http://127.0.0.1:25482;
    }

    location /omni {
        proxy_pass  http://127.0.0.1:8000;
    }
}

然后访问地址变成 http://192.168.10.91/omni
在这里插入图片描述

4. 添加oracle连接

添加oracle ,官方文档说明
这里,我们下载:

  • oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
  • oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm

4.1 安装

rpm -ilv oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm  oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm

4.2 配置环境变量

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib
export TNS_ADMIN=/usr/lib/oracle/12.2/client64
export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export PATH=${ORACLE_HOME}/bin:$PATH

4.3 校验

[root@localhost software]# source /etc/profile
[root@localhost software]# echo ${LD_LIBRARY_PATH}
/usr/lib/oracle/12.2/client64/lib
[root@localhost software]# sqlplus

SQL*Plus: Release 12.2.0.1.0 Production on Tue May 19 12:25:52 2020

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Enter user-name:

然后成功添加连接
在这里插入图片描述

参考:
https://omnidb.org/en/documentation-en/19-deploying-omnidb-server

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章