R的shiny 服务器管理-入门

如果你已经安装好了shiny 服务器,(安装教程)要开始使用了,掌握一些基础知识是必须的。这里我简单学习了一些入门资料,分享给大家,慢慢的我会写一个进阶资料。安装成功之后,系统会增加4个目录,是一定要掌握的:

1、这个目录只存放关键配置文件:/etc/shiny-server/shiny-server.conf   初始状态只有一个文件,记录着非常多的默认信息,默认的网站目录是根目录下的srv的shiny-server目录,端口是3838
2、网站运行log日子存放:/var/log/shiny-server  初始状态下该目录为空
3、程序存放目录是:/srv/shiny-server 初始状态,有一个测试程序:
4、最后是/opt/shiny-server/ 目录,这里面也有一个配置文件:/opt/shiny-server/config/default.config

/etc/systemd/system/shiny-server.service 我的是 (RedHat 7, Ubuntu 15.04+, SLES 12+)
如果是其它一些旧的系统会是/etc/init/shiny-server.conf  (Ubuntu 12.04 through 14.10 and RedHat 6)
或者更旧的系统 /etc/init.d/shiny-server   (RedHat 5, SLES 11)
关于shiny 服务器常见的需要控制的命令,基于我的linux系统版本(RedHat 7, Ubuntu 15.04+, SLES 12+)
sudo systemctl start shiny-server
sudo systemctl stop shiny-server
sudo systemctl restart shiny-server
sudo systemctl kill -s HUP --kill-who=main shiny-server
sudo systemctl status shiny-server  ## 查看状态
sudo systemctl enable shiny-server  ## 开机启动
sudo systemctl disable shiny-server ## 关闭开机启动
## 如果是其它linux版本,请参照shiny官网的服务器维护指南:http://rstudio.github.io/shiny-server/latest/
关于shiny 服务器配置,虽然默认根目录下的/srv的shiny-server目录,端口是3838
server {
  listen 3838;location / {
    site_dir /srv/shiny-server;
log_dir /var/log/shiny-server;directory_index on;
server {
  listen 4949;location / {
    site_dir /srv/shiny-server;
log_dir /var/log/shiny-server;directory_index on; } }

因为我们是以shiny这个用户来运行这些shiny的web app的,所以要给予一定的目录一些适当的权限给shiny用户。

  • /var/lib/shiny-server/ (or whatever custom SHINY_DATA_DIR setting you're using)
  • /var/log/shiny-server/ (and/or whatever other directories you use for logging)
  • /srv/shiny-server/ (and/or whatever other directories you're using to host Shiny applications)
  • /opt/shiny-server/
  • /etc/shiny-server/ (Note that you should enable only read access on this directory, as you likely don't want to allow your Shiny applications (which also run as shiny) to be able to write to your configuration or password file.)
sudo su - -c "R -e \"install.packages('rmarkdown',repos='http://mirror.bjtu.edu.cn/cran/')\""
The app_session_timeout setting can be used to automatically disconnect idle Shiny connections.
Shiny Server is capable of automatically inserting the necessary JavaScript code to enable Google Analytics tracking globally or for a particular server or location.
Memory limits will be added in a coming version of Shiny Server Professional.
Shiny Server can use a wide variety of techniques to keep the data in the web browser synchronized. The preferred technique, and the one most widely used, is the use of WebSockets.
Shiny Server Professional offers the ability to authenticate individual users. By specifying authentication requirements on particular servers or locations, the administrator can control the set of applications particular users are allowed to access.( session$user  和 session$groups)
Regardless of which authentication mechanism is used, the duration of authentication can be configured using the auth_duration setting.
Shiny Server Pro supports the ability to rely on Google for the management of your users using the auth_google setting.
In Shiny Server Professional, SSL encryption is available for any configured server and in the admin interface. SSL is a means of encrypting traffic between web clients and servers and should be used for any application that will accept or transmit sensitive information such as passwords.

Comments are closed.