在Cx_Oracle的Pivotal CloudFoundry上部署即时Oracle [英] Deploy instant oracle on Pivotal CloudFoundry for cx_Oracle

查看:146
本文介绍了在Cx_Oracle的Pivotal CloudFoundry上部署即时Oracle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图用cx_oracle依赖项推送一个python api,它也需要oracle即时客户端,但是我找不到一个在pcf上部署即时客户端的教程,有人曾经这样做过,或者有什么例子应该做什么?欣赏

so im trying to push a python api with cx_oracle dependency which also need oracle instant client,but i couldnt found an tutorial to deploy instant client on pcf,is anybody ever do this before or have any example what should be done? appreciate it

更新:

这是我的.profile的内部

This is the inside of my .profile

LD_LIBRARY_PATH=/home/vcap/app/oracle/instantclient:${LD_LIBRARY_PATH:-}
export OCI_LIB_DIR=/home/vcap/app/oracle/instantclient
export OCI_INC_DIR=/home/vcap/app/oracle/instantclient/sdk/include
export PYTHONPATH=/home/vcap/app/vendor:$PYTHONPATH
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib

推荐答案

  1. 使用Oracle Instant Client的zip安装程序而不是程序包管理器.
  2. 将文件提取到应用程序下的子文件夹,例如 oracle/.
  3. 使用 pip 像通常一样安装 cx-Oracle .
  4. 生成 requirements.txt .
  5. 在应用程序的根目录中添加一个名称为 .profile 的文件,并在其中放入 export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/home/vcap/app/oracle/lib (其中/home/vcap/app 是应用程序文件的路径,而 oracle/lib lib 目录的路径在您在第2步中提取文件的文件夹下).
  6. 然后推送您的应用.
  1. Use the zip installer of the Oracle Instant Client and not a package manager.
  2. Extract the files to a subfolder under your application, like oracle/.
  3. Install cx-Oracle like normal with pip.
  4. Generate requirements.txt.
  5. Add a file with the exact name of .profile to the root of your application, in it put export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vcap/app/oracle/lib (where /home/vcap/app is the path to your application files and oracle/lib is the path to the lib directory beneath the folder where you extracted files in step #2).
  6. Then push your app.

.profile 文件将在实际应用程序启动之前运行,并将调整库搜索路径,以便可以找到Oracle客户端库.

The .profile file will run before your actual application starts and it will adjust the library search path so that the Oracle client libraries can be found.

如果出现错误:

cx_Oracle.DatabaseError:DPI-1047:无法找到64位Oracle客户端库:"/home/vcap/app/oracle/instantclient/libclntsh.so:文件太短"

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "/home/vcap/app/oracle/instantclient/libclntsh.so: file too short"

仔细检查您的 .profile 脚本,并确保您具有正确的 LD_LIBRARY_PATH 设置.

Double check your .profile script and make sure that you have the correct LD_LIBRARY_PATH setting.

这篇关于在Cx_Oracle的Pivotal CloudFoundry上部署即时Oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆