• redis在EOS7服务器进行重启自动设置redis自动开启


    参考文档:
    https://www.cnblogs.com/hxun/p/11075755.html
    方法二:(centos7推荐)
    1.在系统服务目录里创建redis.service文件

    vim /etc/systemd/system/redis.service

    [Unit]
    Description=redis-server
    After=network.target

    [Service]
    Type=forking
    ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
    PrivateTmp=true

    [Install]
    WantedBy=multi-user.target
    注意:ExecStart配置成自己的路径

    配置描述:

      Description:描述服务
      After:描述服务类别
      [Service]服务运行参数的设置
      Type=forking是后台运行的形式
      ExecStart为服务的具体运行命令
      ExecReload为重启命令
      ExecStop为停止命令
      PrivateTmp=True表示给服务分配独立的临时空间
      注意:[Service]的启动、重启、停止命令全部要求使用绝对路径
      [Install]运行级别下服务安装的相关设置,可设置为多用户,即系统运行级别为3

    重载系统服务:systemctl daemon-reload

    2. 测试并加入开机自启

      先关闭redis-server
      systemctl stop redis.service

      开启redis-server
      systemctl start redis.service #如果服务是开启状态,使用此命令会启动失败。

    3. 开启成功,将服务加入开机自启
      systemctl enable redis.service #注意后面不能跟空格

    4. reboot #重启

    5. 查看服务运行状态:systemctl status redis.service

    6. 全部命令

      systemctl start redis.service #启动redis服务
      systemctl enable redis.service #设置开机自启动
      systemctl disable redis.service #停止开机自启动
      systemctl status redis.service #查看服务当前状态
      systemctl restart redis.service  #重新启动服务
      systemctl list-units --type=service #查看所有已启动的服务

    下面为本人的二维码如不嫌弃认识下多多交流!

  • 相关阅读:
    CentOS7 PXE安装批量安装操作系统
    004_MySQL 主从配置
    CentOS 桥接网卡配置
    玩转 Jupyter Notebook (CentOS)
    搭建专属于自己的Leanote云笔记本
    wetty 安装(web+tty)
    wget命令详解
    linux 下find---xargs以及find--- -exec结合使用
    Linux 交换分区swap
    Linux 时区的修改
  • 原文地址:https://www.cnblogs.com/wwwcf1982603555/p/13256146.html
Copyright © 2020-2023  润新知