Gbase8s数据库保姆级安装部署(其他服务器连接数据库服务器) 四

 辅助连接服务器的安装

1. 使用场景

A和B两台服务器,A存在数据库,需要在B上进行连接

2. 步骤

  • A上信息收集
  • B上需要先安装数据库应用,因为dbaccess指令都在数据库应用内部
  • B上配置环境变量
  • B上配置sqlhost文件
  • 配置互信
  • 测试连接

3. 信息收集

服务器

实例名称

安装路径

存在数据库

环境变量文件

通信文件

192.168.6.6

t1

/home/gbasedbt/gbase

test

/home/gbasedbt/profile.t1

/home/gbasedbt/gbase/etc/sqlhosts.t1

192.168.6.7

/home/gbasedbt/gbase

/home/gbasedbt/profile.test

/home/gbasedbt/gbase/etc/sqlhosts.test

4. B上默认已安装数据库应用,配置环境变量

su - gbasedbt 
echo 'source /home/gbasedbt/profile.test' >> /home/gbasedbt/.bash_profile

echo 'export GBASEDBTDIR=/home/gbasedbt/gbase' >> /home/gbasedbt/profile.test
echo 'export GBASEDBTSQLHOSTS=/home/gbasedbt/gbase/etc/sqlhosts.test' >> /home/gbasedbt/profile.test
echo 'export PATH=/home/gbasedbt/gbase/bin:$PATH' >> /home/gbasedbt/profile.test
echo 'export DB_LOCALE=zh_CN.utf8' >> /home/gbasedbt/profile.test
echo 'export CLIENT_LOCALE=zh_CN.utf8' >> /home/gbasedbt/profile.test
echo 'export GL_USEGLU=1' >> /home/gbasedbt/profile.test

5. 配置sqlhosts文件

su - gbasedbt 
cp gbase/etc/sqlhosts.std gbase/etc/sqlhosts.test
echo 't1      onsoctcp        192.168.6.6     9088 '>>gbase/etc/sqlhosts.test

6. 配置互信

--服务器192.168.6.7上,数据库服务器为192.168.6.6
--使用root用户执行以下命令
echo '+ +' >>/etc/hosts.equiv
echo '192.168.6.6' >>/etc/hosts.equiv
echo '192.168.6.6 root' >>/root/.rhosts
echo '192.168.6.7 root' >>/root/.rhosts
echo '192.168.6.6 gbasedbt' >>/root/.rhosts
echo '192.168.6.7 gbasedbt' >>/root/.rhosts
--gbasedbt用户
echo '192.168.6.6 gbasedbt' >>/home/gbasedbt/.rhosts 
echo '192.168.6.7 gbasedbt' >>/home/gbasedbt/.rhosts
--服务器192.168.6.6上,有数据库的服务器IP为192.168.6.6,辅助服务器为192.168.6.7
--使用root用户执行以下命令
echo '+ +' >>/etc/hosts.equiv
echo '192.168.6.6' >>/etc/hosts.equiv
echo '192.168.6.6 root' >>/root/.rhosts
echo '192.168.6.7 root' >>/root/.rhosts
echo '192.168.6.6 gbasedbt' >>/root/.rhosts
echo '192.168.6.7 gbasedbt' >>/root/.rhosts
--gbasedbt用户
echo '192.168.6.6 gbasedbt' >>/home/gbasedbt/.rhosts 
echo '192.168.6.7 gbasedbt' >>/home/gbasedbt/.rhosts

7. 测试连接

--生效环境变量
source /home/gbasedbt/profile.test
--连接
--test为服务器上的数据库,t1为实例名称
[gbasedbt@node02 ~]$ dbaccess test@t1 -
Your evaluation license will expire on 2025-05-09 00:00:00

Database selected.

  • 10
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值