puppet 3+Unicorn+Nginx安装配置
puppet 3+Unicorn+Nginx安装配置
2014-08-15 10:58 酒瓶不倒 酒瓶不倒的博客 字号:T | T
一键收藏,随时查看,分享好友!
Unicorn 效率要比 Webrick 高很多,所以决定要用Unicorn 替换 Webrick……
AD:2014WOT全球软件技术峰会北京站 课程视频发布
11月21日-22日 与WOT技术大会相约深圳 现在抢票
puppet server 安装
rpm -ivh http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-6.noarch.rpm
yum install puppet-server -y
puppet server puppet.conf 配置: cat /etc/puppet/puppet.conf
[main]
# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet
# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet
# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl
autosign = $confdir/autosign.conf { mode = 664 }
[agent]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt
# Where puppetd caches the local configuration. An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig
[development]
modulepath = /etc/puppet/modules:/usr/share/puppet/modules
config_version =
[production]
modulepath = /etc/puppet/modules:/usr/share/puppet/modules
config_version =
Unicorn 安装配置 yum install ruby-devel make gcc
gem install unicorn rack
cp /usr/share/puppet/ext/rack/config.ru /etc/puppet/
vi /etc/puppet/unicorn.conf
worker_processes 8
working_directory "/etc/puppet"
listen '/var/run/puppet/puppetmaster_unicorn.sock', :backlog => 512
timeout 120
pid "/var/run/puppet/puppetmaster_unicorn.pid"
preload_app true
if GC.respond_to?(:copy_on_write_friendly=)
GC.copy_on_write_friendly = true
end
before_fork do |server, worker|
old_pid = "#{server.config[:pid]}.oldbin"
if File.exists?(old_pid); server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
end
调试: unicorn -c /etc/puppet/unicorn.conf
I, [2014-08-15T08:55:36.452577 #9031] INFO -- : Refreshing Gem list
I, [2014-08-15T08:55:38.779972 #9031] INFO -- : unlinking existing socket=/var/run/puppet/puppetmaster_unicorn.sock
I, [2014-08-15T08:55:38.780441 #9031] INFO -- : listening on addr=/var/run/puppet/puppetmaster_unicorn.sock fd=6
I, [2014-08-15T08:55:38.787469 #9059] INFO -- : worker=0 spawned pid=9059
I, [2014-08-15T08:55:38.790368 #9059] INFO -- : worker=0 ready
I, [2014-08-15T08:55:38.792410 #9060] INFO -- : worker=1 spawned pid=9060
I, [2014-08-15T08:55:38.795405 #9060] INFO -- : worker=1 ready
I, [2014-08-15T08:55:38.796387 #9061] INFO -- : worker=2 spawned pid=9061
I, [2014-08-15T08:55:38.799071 #9061] INFO -- : worker=2 ready
I, [2014-08-15T08:55:38.801353 #9062] INFO -- : worker=3 spawned pid=9062
I, [2014-08-15T08:55:38.804052 #9062] INFO -- : worker=3 ready
I, [2014-08-15T08:55:38.805570 #9063] INFO -- : worker=4 spawned pid=9063
I, [2014-08-15T08:55:38.808220 #9063] INFO -- : worker=4 ready
I, [2014-08-15T08:55:38.810281 #9064] INFO -- : worker=5 spawned pid=9064
I, [2014-08-15T08:55:38.812904 #9064] INFO -- : worker=5 ready
I, [2014-08-15T08:55:38.814869 #9065] INFO -- : worker=6 spawned pid=9065
I, [2014-08-15T08:55:38.817497 #9065] INFO -- : worker=6 ready
I, [2014-08-15T08:55:38.817731 #9031] INFO -- : master process ready
I, [2014-08-15T08:55:38.819580 #9066] INFO -- : worker=7 spawned pid=9066
I, [2014-08-15T08:55:38.822096 #9066] INFO -- : worker=7 ready
按ctrl+c结束 编写启动脚本 vi /etc/init.d/puppet-unicorn
#!/bin/bash
# unicorn-puppet
# chkconfig: - 98 02
#
# description: Enables periodic system configuration checks through unicorn-puppet.
# processname: unicorn-puppet
# Source function library.
. /etc/rc.d/init.d/functions
lockfile=/var/lock/puppetmaster-unicorn
pidfile=/var/run/puppet/puppetmaster_unicorn.pid
RETVAL=0
DAEMON=/usr/bin/unicorn
DAEMON_OPTS="-D -c /etc/puppet/unicorn.conf"
start() {
echo -n $"Starting puppet unicorn: "
daemon $DAEMON $DAEMON_OPTS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping puppet unicorn: "
kill `cat $pidfile`
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f {$lockfile} {$pidfile}
[ $RETVAL -eq 0 ] && echo_success || echo_failure
echo
return $RETVAL
}
restart() {
stop
start
}
usage() {
echo "Usage: $0 {start|stop|restart}" ;
return 3
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
usage
;;
esac
exit $RETVAL
chmod +x /etc/init.d/puppet-unicorn
chkconfig puppet-unicorn on
配置nginx vi /etc/nginx/conf.d/puppets-unicorn
upstream puppetmaster_unicorn {
server unix:/var/run/puppet/puppetmaster_unicorn.sock fail_timeout=0;
}
server {
listen 8140;
ssl on;
ssl_session_timeout 5m;
ssl_certificate /var/lib/puppet/ssl/certs/puppet.test.com.pem;
ssl_certificate_key /var/lib/puppet/ssl/private_keys/puppet.test.com.pem;
ssl_client_certificate /var/lib/puppet/ssl/ca/ca_crt.pem;
ssl_ciphers SSLv2:-LOW:-EXPORT:RC4+RSA;
ssl_verify_client optional;
root /usr/share/empty;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Client-Verify $ssl_client_verify;
proxy_set_header X-Client-DN $ssl_client_s_dn;
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
proxy_read_timeout 120;
location / {
proxy_pass http://puppetmaster_unicorn;
proxy_redirect off;
}
}
/etc/init.d/nginx start
chkconfig nginx on
参考网址: https://linuxmoz.com/rhel-centos-install-puppet-nginx-unicorn/ http://projects.puppetlabs.com/projects/1/wiki/using_unicorn 原文链接:http://my.oschina.net/u/142602/blog/301400
puppet 3+Unicorn+Nginx安装配置的更多相关文章
- Nginx安装配置(转)
Nginx 安装配置 Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向代理 服务器,也是一个 IMAP/POP3/ ...
- Nginx安装配置PHP(FastCGI)环境的教程
这篇是Nginx安装配置PHP(FastCGI)环境的教程.Nginx不支持对外部程序的直接调用或者解析,所有的外部程序(包括PHP)必须通过FastCGI接口来调用. 一.什么是 FastCGI F ...
- Nginx安装配置与HelloWorld
<深入理解Nginx>阅读与实践(一):Nginx安装配置与HelloWorld 最近在读陶辉的<深入理解Nginx:模块开发与架构解析>,一是想跟着大牛练练阅读和编写开源代码 ...
- Nginx 安装 配置 使用
Nginx 安装 配置 使用 基本的HTTP服务器特性 处理静态文件,索引文件以及自动索引:打开文件描述符缓存(缓存元数据和文件描述符,下一次可以直接从内存找到数据或者文件的位置): 使用缓存加速反向 ...
- VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)
首先启动Nginx 1. 相关浏览 两个 Tomcat 配置: VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...
- VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二)
准备工作 相关浏览: VMware Linux 下 Nginx 安装配置 (一) 1. 选在 /usr/local/ 下创建 softs 文件夹,通过 ftp 命令 把 apache-tomcat-7 ...
- Hearbeat + Nginx 安装配置
Hearbeat + Nginx 安装配置 实验环境 两台主机:Linux Centos 6.5 32位 主 服务端:Hearbeat + Nginx eth0:192.168.1.160(公网) e ...
- Nginx安装配置|Nginx反向代理|Nginx支持HTTPS|Nginx重定向
Nginx安装配置 可以直接看到最下面的HTTPS. Nginx安装 我的系统如下: No LSB modules are available. Distributor ID: Ubuntu Desc ...
- nginx安装配置_runoob_阅读笔记_20190917
Nginx 安装配置_runoob菜鸟教程 Nginx 安装配置 Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向 ...
随机推荐
- Windows环境下安装Hadoop+Hive的使用案例
Hadoop安装: 首先到官方下载官网的hadoop2.7.7,链接如下 https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/ 找网盘的 ...
- 【Python】【demo实验16】【练习实例】【打印所有水仙花数】
题目: 打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身.例如:153是一个"水仙花数",因为153= ...
- 理解twisted中的reactor和deferred(二)
Deferred可以添加多个回调函数,每个回调函数的结果作为下一个回调函数的参数 代码实例(可在pycharm中运行,摘自 https://twistedmatrix.com/documents/cu ...
- 「java.util.concurrent并发包」之 ThreadPoolExecutor
一 异步用new Thread? 大写的"low"!! new Thread(new Runnable() { @Override public void run() { // T ...
- Tomcat: has been normalized to [null] which is not valid
环境 tomcat 8.5 原因 在使用相对路径加载配置文件时,如果相对路径超出了 tomcat 容器的根目录,那么 tomcat 会提示 xxx has been normalized to [nu ...
- 老贾的第二天(git常用命令)
git init #创建一个本地的仓库 **git add test.txt #指定文件添加 ***git add . #当前文件夹下所有内容 添加到暂存区 ***git commit -m &quo ...
- opencv+ linux + cmake 生成 opencv静态库
您可以省去如下步骤,直接下载我编译好的: http://download.csdn.net/detail/u011258240/9710331 一.编译opencv2.4 不带contrib 1. ...
- python爬虫下正则各种字符串数据匹配
s = '*\/:?"<>|' #这9个字符在Windows系统下是不可以出现在文件名中的str1 = '\巴拉<1"!11[]>1*hgn/p:?|' # ...
- vue打包后css背景图片地址找不到
背景图片变成了这样:static/css/static/imgs/xxx.jpg 解决方法,修改build/utils,添加 publicPath: '../../' 就行 对比了下,com ...
- URL的 ? 和 # (hash),如何将参数保存在URL中,用于刷新获取之前的变量?
URL中会带上参数,假如是?开头的,那这个是会被加入到ajax请求中的,#(hash)相当于书签锚点,用于定位页面,不会加入到ajax请求中,所以有些时候,我们可以把一些参数放在#后面 如何获取URL ...