修改rsession.conf配置文件后,无法登陆Rstudio|修改rsession.conf配置文件后,无法登陆Rstudio server解决办法

写在前面 问题经常有,今年特别多。
也不知道是不是因为centos系统的原因,为啥明明我还在跑着程序,2个小时后,RStudio server自动退出登陆界面了。于是通过查询得知,可以通过修改/etc/rstudio/rsession.conf文件,让用户session 将不会suspend,一直运行。
正文 修改rsession.conf文件

vim /etc/rstudio/rsession.conf 添加session-timeout-minutes=0#会话超时时间

接着我尝试重启Rstudio server让其生效
rstudio-server restart #重启

后来就遇到了发现登不进Rstudio server了,但是xshell均正常。
检查Rstudio server 状态
sudo systemctl status rstudio-server###报错信息 ● rstudio-server.service - RStudio Server Loaded: loaded (/usr/lib/systemd/system/rstudio-server.service; enabled; vendor preset: disabled) Active: failed (Result: start-limit) since 一 2021-04-12 09:05:11 CST; 3min 52s ago Process: 170465 ExecStop=/usr/bin/killall -TERM rserver (code=exited, status=0/SUCCESS) Process: 217615 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS) Main PID: 217616 (code=exited, status=1/FAILURE) Tasks: 1 CGroup: /system.slice/rstudio-server.service └─147061 /usr/lib/rstudio-server/bin/rserver4月 12 09:05:11 localhost.localdomain systemd[1]: Unit rstudio-server.service entered failed state. 4月 12 09:05:11 localhost.localdomain systemd[1]: rstudio-server.service failed. 4月 12 09:05:11 localhost.localdomain systemd[1]: rstudio-server.service holdoff time over, scheduling restart. 4月 12 09:05:11 localhost.localdomain systemd[1]: Stopped RStudio Server. 4月 12 09:05:11 localhost.localdomain systemd[1]: start request repeated too quickly for rstudio-server.service 4月 12 09:05:11 localhost.localdomain systemd[1]: Failed to start RStudio Server. 4月 12 09:05:11 localhost.localdomain systemd[1]: Unit rstudio-server.service entered failed state. 4月 12 09:05:11 localhost.localdomain systemd[1]: rstudio-server.service failed. [root@localhost rstudio]# sudo systemctl stop rstudio-server [root@localhost rstudio]# sudo systemctl start rstudio-server [root@localhost rstudio]# sudo systemctl status rstudio-server ● rstudio-server.service - RStudio Server Loaded: loaded (/usr/lib/systemd/system/rstudio-server.service; enabled; vendor preset: disabled) Active: failed (Result: start-limit) since 一 2021-04-12 09:10:24 CST; 1s ago Process: 170465 ExecStop=/usr/bin/killall -TERM rserver (code=exited, status=0/SUCCESS) Process: 218168 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS) Main PID: 218169 (code=exited, status=1/FAILURE) Tasks: 1 CGroup: /system.slice/rstudio-server.service └─147061 /usr/lib/rstudio-server/bin/rserver

【修改rsession.conf配置文件后,无法登陆Rstudio|修改rsession.conf配置文件后,无法登陆Rstudio server解决办法】去google了比较多帖子,都没有找到一个合适的办法,最终在Stack Overflow里面找到解决办法
原因解析
The reason why you can not restart rstudio-server is that the PORT 8787 was been using by previous rserver. After knowing this, the solution is easy. First, check the pid that was using PORT 8787
简单来说就是原8787端口被其他资源占用了,把占用的程序kill掉就解决了
解决办法
#查看占用端口 sudo netstat -anp | grep 8787 # tcp00 0.0.0.0:87870.0.0.0:*LISTENpid/rserver#Second, kill this pid (use your pid) sudo kill -9 #Third, restart rstudio-server or reinstall resutio server package rstudio-server restart #重启

至此,问题解决, RStudio Server也顺利登陆。

    推荐阅读