博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【Memache】部署Memcache,采用Supervisord管理
阅读量:7237 次
发布时间:2019-06-29

本文共 3257 字,大约阅读时间需要 10 分钟。

1.修改主机名

vim /etc/hostnamevim /etc/hosts hostname 
<主机名>

2.服务器磁盘挂载

vim /data/scripts/auto_fdisk.sh

3.将磁盘挂载修改为uuid方式

blkid /dev/xvdb1vim /etc/fstab UUID=41852b97-3630-42b1-b2ae-9d8f77922245 /data ext4 defaults 1 2

4.初始化服务器

#!/bin/shyum clean allsystemctl stop firewalld.servicesystemctl disable firewalld.servicesed -i 's/enforcing/disabled/g' /etc/selinux/configyum -y install vim openssh* ntp wget screen bash-completion gitservice ntpd stopntpdate time.nist.govsed -i 's/0.centos.pool.ntp.org/time.nist.gov/g' /etc/ntp.confchkconfig ntpd onservice ntpd restart

5.安装程序

下载oneinstack,根据需求安装所需memcached与supervisord

6.执行cache初始化脚本

#!/bin/sh -e########## 1. 基础工作 start ##########tmux_conf=/root/.tmux.confchk_service_super=`systemctl status supervisord.service | grep inactive`if [[ -n $chk_service_super ]]then    echo "supervisord is inactive..."else    sudo service supervisord stopfichk_service_hhvm=`systemctl status hhvm | grep inactive`if [[ -n $chk_service_hhvm ]]then    echo "hhvm is inactive..."else    sudo service hhvm stopfimkdir -p /data/logsmkdir -p /data/backupmkdir -p /data/components/mkdir -p /data/scriptsmkdir -p /data/softsmkdir -p /data/logs/accessmkdir -p /data/logs/generalmkdir -p /data/logs/logicmkdir -p /data/logs/error/supervisorchmod -R 777 /data/logs/*chmod -R 777 /data/components/# 常用类库sudo yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel# 常用软件sudo yum -y install net-tools unzip vim lrzsz subversion tmux# tmux配置cat > $tmux_conf <

7.配置supervisord

7.1 启动supervisord服务

service supervisord start

7.2 修改supervisord配置文件

vim /etc/supervisord.conf修改如下信息:[include]files = supervisord.d/*.ini#[program:hhvm]#command=/usr/bin/hhvm --mode server --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf#numprocs=1 ; number of processes copies to start (def 1)#directory=/tmp ; directory to cwd to before exec (def no cwd)#autostart=true ; start at supervisord start (default: true)#autorestart=unexpected ; whether/when to restart (default: unexpected)#stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)

7.4 添加memcached信息

vim /etc/supervisord/mc_11211.inivim /etc/supervisord/mc_11212.inivim /etc/supervisord/mc_11213.ini

添加如下信息

[program:mc_11211]command=/usr/local/memcached/bin/memcached -p 11211 -u memcached -m 2048 -c 10240 -l 10.0.0.51user=root                                ;执行命令的用户numprocs=1                            ; 启动几个进程 默认 1#process_name=%(process_num)02d;directory=                              ; 执行前要不要先cd到目录去autostart=true                          ; 随着supervisord的启动而启动autorestart=true                        ; 是否自动重启 默认truestartretries=5                          ; 启动失败时的最多重试次数 默认5;;exitcodes=0                            ; 正常退出代码;;stopsignal=KILL                         ; 用来杀死进程的信号;;stopwaitsecs=10                        ; 发送SIGKILL前的等待时间redirect_stderr=true                     ; 重定向stderr到stdoutstdout_logfile=/data/logs/error/supervisor/mc_11211.logstderr_logfile=/data/logs/error/supervisor/mc_11211.log

8.最终配置

关闭防火墙服务

systemctl stop firewalld.servicesystemctl disable firewalld.service

关闭memcached服务

service memcached stop

关闭memcached开机自启

chkconfig memcached off

重启supervisord,采用supervisord启动memcached

service supervisord restart

转载地址:http://pagfm.baihongyu.com/

你可能感兴趣的文章
网络流简介
查看>>
How to fix “HTTP Status Code 505 – HTTP Version Not Supported” error?--转
查看>>
mybatis结合mysql批量操作及查询sql
查看>>
Java 底层机制(JVM/堆/栈/方法区/GC/类加载)
查看>>
实时流处理Storm、Spark Streaming、Samza、Flink孰优孰劣
查看>>
Oracle的体系结构(一)
查看>>
linux的防火墙
查看>>
python_16
查看>>
多表查询之多表查询的概述
查看>>
Chrome提示同步错误
查看>>
常用命令整理
查看>>
WebFlux 学习 —— 基本概念
查看>>
server2016下搭建web服务器&三种虚拟主机实验文档
查看>>
快速安装mongodb
查看>>
堆和栈 各种变量存储位置
查看>>
代码管理平台
查看>>
linux操作系统基础
查看>>
[转]linux下tcp选项TCP_DEFER_ACCEPT详解
查看>>
第五周学习总结
查看>>
Oracle高级查询之LAG和LEAD分析函数
查看>>