搭建hadoop集群 使用集群命令 xcall 时 出现
------------------slave2 --------------------
bash: jps: command not found
查看了我的环境变量 cat /etc/profile 后几行如下:
发现配置好了,没错啊 但就是有问题
在大佬的帮助下,发现 # ~/.bashrc 也是配置环境变量的地方 就索性吧 #set java home 下的行也配到这个里面
然后source ~/.bashrc
再出回到master里 执行xcall jps 就好!!!
再后来 发现我这个master里的 #~/.bashrc里没有配 也是能用的啊
想了下原因 结论如下:
ssh连接过去并没有读取etc profile文件,看来是读取了.bashrc
解决方案
配置环境时 /etc/profile 和 /etc/bashrc两个文件都配上 就没这个问题啦
这个博客详细描述了profile和bashrc的区别 https://www.cnblogs.com/hongzg1982/articles/2101792.html