摘要:修改主机名主机名服务器磁盘挂载将磁盘挂载修改为方式初始化服务器安装程序下载,根据需求安装所需与执行初始化脚本基础工作常用类库常用软件配置设置前缀为解除与前缀的对应关系
1.修改主机名
vim /etc/hostname vim /etc/hosts hostname <主机名>2.服务器磁盘挂载
vim /data/scripts/auto_fdisk.sh3.将磁盘挂载修改为uuid方式
blkid /dev/xvdb1 vim /etc/fstab UUID=41852b97-3630-42b1-b2ae-9d8f77922245 /data ext4 defaults 1 24.初始化服务器
#!/bin/sh yum clean all systemctl stop firewalld.service systemctl disable firewalld.service sed -i "s/enforcing/disabled/g" /etc/selinux/config yum -y install vim openssh* ntp wget screen bash-completion git service ntpd stop ntpdate time.nist.gov sed -i "s/0.centos.pool.ntp.org/time.nist.gov/g" /etc/ntp.conf chkconfig ntpd on service ntpd restart5.安装程序
下载oneinstack,根据需求安装所需memcached与supervisord
6.执行cache初始化脚本#!/bin/sh -e
########## 1. 基础工作 start ##########
tmux_conf=/root/.tmux.conf
chk_service_super=`systemctl status supervisord.service | grep inactive`
if [[ -n $chk_service_super ]]
then
echo "supervisord is inactive..."
else
sudo service supervisord stop
fi
chk_service_hhvm=`systemctl status hhvm | grep inactive`
if [[ -n $chk_service_hhvm ]]
then
echo "hhvm is inactive..."
else
sudo service hhvm stop
fi
mkdir -p /data/logs
mkdir -p /data/backup
mkdir -p /data/components/
mkdir -p /data/scripts
mkdir -p /data/softs
mkdir -p /data/logs/access
mkdir -p /data/logs/general
mkdir -p /data/logs/logic
mkdir -p /data/logs/error/supervisor
chmod -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.ini
vim /etc/supervisord/mc_11212.ini
vim /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.51
user=root ;执行命令的用户
numprocs=1 ; 启动几个进程 默认 1
#process_name=%(process_num)02d
;directory= ; 执行前要不要先cd到目录去
autostart=true ; 随着supervisord的启动而启动
autorestart=true ; 是否自动重启 默认true
startretries=5 ; 启动失败时的最多重试次数 默认5
;;exitcodes=0 ; 正常退出代码
;;stopsignal=KILL ; 用来杀死进程的信号
;;stopwaitsecs=10 ; 发送SIGKILL前的等待时间
redirect_stderr=true ; 重定向stderr到stdout
stdout_logfile=/data/logs/error/supervisor/mc_11211.log
stderr_logfile=/data/logs/error/supervisor/mc_11211.log
8.最终配置
关闭防火墙服务
systemctl stop firewalld.service
systemctl disable firewalld.service
关闭memcached服务
service memcached stop
关闭memcached开机自启
chkconfig memcached off
重启supervisord,采用supervisord启动memcached
service supervisord restart
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/61722.html
摘要:部署一个应用程序的过程绝对是一个噩梦般的经历。准备开始,我们创建一个一个中包含怎样创建你想要的镜像的指令。使用告知使用官方社区最新版本的可用镜像。这个镜像在的可用版本。 注:本文由 Mike Ebinum 编写,原文地址 Creating a Docker Container to run PHP, NGINX and Hip Hop VM (HHVM) showImg(ht...
摘要:部署一个应用程序的过程绝对是一个噩梦般的经历。准备开始,我们创建一个一个中包含怎样创建你想要的镜像的指令。使用告知使用官方社区最新版本的可用镜像。这个镜像在的可用版本。 注:本文由 Mike Ebinum 编写,原文地址 Creating a Docker Container to run PHP, NGINX and Hip Hop VM (HHVM) showImg(ht...
摘要:基础工作常用类库常用软件配置设置前缀为解除与前缀的对应关系将快捷键设置为模式基础工作部署部署 #!/bin/bash ########## 1. 基础工作 start ########## tmux_conf=/root/.tmux.conf chk_service_super=`systemctl status supervisord.service | grep inacti...
摘要:作者运维博客博客地址文章地址相关话题是近两年来发展较快,比较活跃,非常清新的一个管理平台,提供对宿主机和虚机的统一管理,它有别于自带的图形管理工具,让管理变得更为可视化,对中小型应用场景带来了更多方便。作者:SRE运维博客博客地址: https://www.cnsre.cn/文章地址:https://www.cnsre.cn/posts/211117937177/相关话题:https://w...
摘要:上一篇文章第四章网站部署第二节静态文件后台运行一般调试过程中我们使用运行网站,方便我们在命令行中看运行状况。默认情况下,会监控子进程,并在任何程序意外终止时重生。配合实现多进程在中添加接受命令行参数可在配置文件中添加使用代理 上一篇文章:Python:Tornado 第四章:Tornado网站部署:第二节:静态文件 1、后台运行 一般调试过程中我们使用python app.py运行网...
阅读 1027·2019-08-30 15:54
阅读 3531·2019-08-29 15:33
阅读 2921·2019-08-29 13:48
阅读 1575·2019-08-26 18:26
阅读 3538·2019-08-26 13:55
阅读 1814·2019-08-26 10:45
阅读 1410·2019-08-26 10:19
阅读 510·2019-08-26 10:16