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

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