yesono
V2EX  ›  问与答

造了个轮子 LNMP-Oneinstack

  •  3
     
  •   yesono · Apr 13, 2016 · 16049 views
    This topic created in 3864 days ago, the information mentioned may be changed or developed.

    一晃 2 年多,还记得 2 年前在 V2EX 发的贴,预写更好用的 lnmp : http://v2ex.com/t/87708

    通过网友反馈、鞭策,在 lnmp 基础上增加很多功能,如 java 、 hhvm 等,于是有一个新名字: OneinStack

    之后用的人越来越多( lnmp : Sart809 fork317 ; OneinStack : Star 172 fork 84 ),反馈很多,吸取很多想法,不断改进,但我是有强迫症的人,希望做到完美,个人想法是有限的,又来 V2EX 取经啦,希望各位大大给点意见或吐槽。。。。。

    相关链接:

    https://github.com/lj2007331/lnmp

    https://github.com/lj2007331/oneinstack

    85 replies  •  2018-10-18 15:31:24 +08:00
    d5d
    d5d
    Apr 13, 2016
    1
    能用在生产环境?备份迁移是否方便?
    xiaoz
    xiaoz
    Apr 13, 2016
    2
    目前就在用 Oneinstack ,支持楼主,更新得也比较快。
    yesono
    yesono
    OP
    Apr 13, 2016
    3
    @d5d 已经有很多人用在生产环境,内置备份脚本
    tattoomaster
    tattoomaster
    Apr 13, 2016
    4
    顶我们的 yeho 大神
    谢谢你的系统,帮了我大忙
    beyoung
    beyoung
    Apr 13, 2016 via iPhone
    5
    这个必须支持 非常方便
    Yamade
    Yamade
    Apr 13, 2016
    6
    做成 docker 不是更好么?
    sewyu
    sewyu
    Apr 13, 2016
    7
    oneinstack 非常好用,软件版本更新非常快。 非常感谢!
    yesono
    yesono
    OP
    Apr 13, 2016
    8
    @Yamade 计划中,,,
    a1058021348
    a1058021348
    Apr 13, 2016 via iPhone
    9
    曾经在 oneinstack 反馈区问过一个小白问题,很快得到楼主的回复并解决问题,让我十分感激。再次致谢并支持楼主。
    Shura
    Shura
    Apr 13, 2016 via Android
    10
    支持楼主,目前在用 OneinStack ,更新组件功能我非常喜欢。
    KKKKKK
    KKKKKK
    Apr 13, 2016 via Android
    11
    服务器最低配置要求多少😂😂
    kchum
    kchum
    Apr 13, 2016
    12
    原来是 LZ 的,有关注过。
    yesono
    yesono
    OP
    Apr 13, 2016
    13
    @KKKKKK php 1core 512M RAM 够了, java 1G ram 以上,建议 mariadb
    bt0
    bt0
    Apr 13, 2016
    14
    @Livid 这个好像应该 move 到技术或者创意节点吧
    Andy1999
    Andy1999
    Apr 13, 2016 via iPhone
    15
    可是你的脚本装了太多东西,不符合很多人的用户习惯
    而且我用了一次我的 IDCF 彻底开不起来了
    yiqingfeng
    yiqingfeng
    Apr 13, 2016
    16
    大力支持,希望好用的东西越来越多,重要是免费。
    shinko
    shinko
    Apr 13, 2016
    17
    虽然不用,但是一直有关注在学习
    yesono
    yesono
    OP
    Apr 13, 2016
    18
    @Andy1999 可以选择安装, y 、 n ,比如只安装 mysql 也可以。。。
    bazingaterry
    bazingaterry
    Apr 13, 2016 via iPhone
    19
    目前四个网站都是跑在楼主的脚本下面,很稳定,更新也方便,谢谢楼主!
    AstroProfundis
    AstroProfundis
    Apr 13, 2016
    20
    https://v2ex.com/t/87755
    我想知道有没有人有闲心再做一下这个测试
    不是针对楼主,是真的好奇,因为我至今也认为上面帖子里的结果是不符合直觉的
    AstroProfundis
    AstroProfundis
    Apr 13, 2016
    21
    如果谁有心能反复测试各种参数 /配置找到超过源安装的组合,也算造福大众了
    ptsa
    ptsa
    Apr 13, 2016
    22
    树莓派这类 arm 上跑不知道效果怎么样
    想买个 Cubieboard 5
    不过新出来 server 系统还没出
    yesono
    yesono
    OP
    Apr 13, 2016
    23
    @AstroProfundis 已经改进过很多,可以再测试下,只有有朋友线上,跑一台 lnmp ( php5.6 )并发 1w 无压力,当然 php 程序比较简单。。。
    AstroProfundis
    AstroProfundis
    Apr 13, 2016
    24
    @yesono 关键不是实际性能的绝对值,而是和编译安装和包安装的相对性能差距,我有空可以试试(最近不一定),以及我实在想不通编译的会比源里面的差是为什么...
    Andy1999
    Andy1999
    Apr 13, 2016 via iPhone
    25
    @yesono 举个例子,你的脚本会修改系统语言,改 HostName 装 htop 等 我不知道这些用意何在
    貌似还有加 Swap
    yesono
    yesono
    OP
    Apr 13, 2016
    26
    @Andy1999 include/init_*.sh 开头的文件可以改。如系统默认没有 swap ,内存小于 2G 会加,否则不加,因为小内存编译通不过。
    yesono
    yesono
    OP
    Apr 13, 2016
    27
    @AstroProfundis 没必要纠结吧,大多数都是源码编译,有自己想要的参数,大公司通常做法是源码编译,打成 rpm 包。。。
    AstroProfundis
    AstroProfundis
    Apr 13, 2016
    28
    @yesono 所以我就是想知道 {官方源打包,自己建源打包,自己直接编译} 这几样东西到底有什么区别,就目前观察到的情况是官方源和自己打包性能没有明显差距,直接编译会更差,但不知道为什么
    flymemory
    flymemory
    Apr 13, 2016
    29
    一直在用 oneinstack ,很赞~~
    yesono
    yesono
    OP
    Apr 13, 2016
    30
    @AstroProfundis 自己打包也是源码编译,有空再测试下哦,期望反馈。。。
    AstroProfundis
    AstroProfundis
    Apr 13, 2016
    31
    @yesono 是的,这个是最奇怪的地方,目前只能想到打包操作的整体编译环境会和直接编译不一样,这几天有空我会尽量试一下,但不一定_(:зゝ∠)_
    powtop
    powtop
    Apr 13, 2016
    32
    不错 一直在用 挺好的
    ivmm
    ivmm
    Apr 13, 2016
    33
    OpenResty

    模块太少,基本是废的呀
    badcode
    badcode
    Apr 13, 2016 via iPhone
    34
    原来是楼主
    2016-04-08:
    增加 OpenResty
    在 oneinstack.com 看到的

    自己编译的没楼主的好
    改些东西自己用,不错
    lzsadam
    lzsadam
    Apr 13, 2016
    35
    自从 google 到 https://blog.linuxeye.com/31.html
    之后就一直在用了
    yesono
    yesono
    OP
    Apr 13, 2016
    36
    @lzsadam 哈哈,后面重新命名了。。。
    lazyyz
    lazyyz
    Apr 13, 2016
    37
    支持!赞!
    RangerWolf
    RangerWolf
    Apr 13, 2016
    38
    强烈需要一个 mysql 主备一键部署。。。
    gpw1987
    gpw1987
    Apr 13, 2016
    39
    支持一样,楼主这样额努力才能有更多的人使用 LNMP
    yuewolf
    yuewolf
    Apr 13, 2016
    40
    一直在用 lnmp ,感觉很好很方便,特别是小内存 VPS 。

    唯一美中不足的就是源码包略显滞后,每次部署以后,都得自己升级一下。有机会试用下 LZ 的工具包。
    yesono
    yesono
    OP
    Apr 13, 2016
    41
    @yuewolf 后期会打成 rpm 包
    xrui
    xrui
    Apr 13, 2016 via Android
    42
    原来备份网站直接 rsyns ,现在是打包再传,能改回原来的嘛……几个 G 流量就没了
    PhA
    PhA
    Apr 13, 2016
    43
    我更喜欢安装官方的,之后优化参数,感觉自己编译的和官方的没啥区别
    tester4
    tester4
    Apr 13, 2016
    44
    我在用这个呢,挺好用的,想要 PHP7+APCU
    yesono
    yesono
    OP
    Apr 13, 2016
    45
    @tester4 php7 建议用内置 opcache ,原汁原味 哈哈
    AstroProfundis
    AstroProfundis
    Apr 13, 2016
    46
    下午没事又搞了一遍,和 https://v2ex.com/t/87755 这里几乎完全一样方法
    两台 OpenVZ 虚拟机 256MB RAM/256MB vSwap, 4 CPU, Debian Wheezy 64bit 更新到最新
    装上 WordPress 3.7.1 英文版并导入主题测试用例
    再从同母机的第三台虚机用 ab 抓第二页 ab -n 25000 -c 50 http://hostname/?paged=2

    ----
    首先是源安装,用了 dotdeb 的默认源
    PHP 5.4.45-1~dotdeb+7.1 / MySQL 5.6.29 / nginx 1.8.1
    除了 nginx 加上了 PHP 支持以外,全部使用默认配置

    其 PHP 配置为:
    pm = dynamic
    pm.max_children = 5
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3

    结果:
    This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/

    Benchmarking x.x.x.167 (be patient)


    Server Software: nginx/1.8.1
    Server Hostname: x.x.x.167
    Server Port: 80

    Document Path: /?paged=2
    Document Length: 48526 bytes

    Concurrency Level: 50
    Time taken for tests: 7082.100 seconds
    Complete requests: 25000
    Failed requests: 0
    Total transferred: 1218625000 bytes
    HTML transferred: 1213150000 bytes
    Requests per second: 3.53 [#/sec] (mean)
    Time per request: 14164.201 [ms] (mean)
    Time per request: 283.284 [ms] (mean, across all concurrent requests)
    Transfer rate: 168.04 [Kbytes/sec] received

    Connection Times (ms)
    min mean[+/-sd] median max
    Connect: 0 0 0.1 0 2
    Processing: 1052 14149 1201.5 13998 19505
    Waiting: 154 12951 1037.2 12671 17456
    Total: 1054 14149 1201.5 13998 19505

    Percentage of the requests served within a certain time (ms)
    50% 13998
    66% 14600
    75% 14957
    80% 15202
    90% 15765
    95% 16223
    98% 16772
    99% 17149
    100% 19505 (longest request)
    AstroProfundis
    AstroProfundis
    Apr 13, 2016
    47
    接下来使用楼主的 oneinstack 编译安装,尽量选择了和源安装一样版本的组件
    PHP 5.4.45 / MySQL 5.6.29 / nginx 1.9.14
    使用自带脚本新建虚拟主机安装 WordPress, 没有做任何性能相关的配置调整

    其 PHP 配置为:
    pm = dynamic
    pm.max_children = 4
    pm.start_servers = 2
    pm.min_spare_servers = 2
    pm.max_spare_servers = 4
    pm.max_requests = 2048
    pm.process_idle_timeout = 10s

    结果:
    This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/

    Benchmarking x.x.x.169 (be patient)


    Server Software: nginx
    Server Hostname: x.x.x.169
    Server Port: 80

    Document Path: /?paged=2
    Document Length: 48542 bytes

    Concurrency Level: 50
    Time taken for tests: 6709.842 seconds
    Complete requests: 25000
    Failed requests: 0
    Total transferred: 1218475000 bytes
    HTML transferred: 1213550000 bytes
    Requests per second: 3.73 [#/sec] (mean)
    Time per request: 13419.683 [ms] (mean)
    Time per request: 268.394 [ms] (mean, across all concurrent requests)
    Transfer rate: 177.34 [Kbytes/sec] received

    Connection Times (ms)
    min mean[+/-sd] median max
    Connect: 0 0 0.1 0 2
    Processing: 1025 13407 1253.2 12827 19857
    Waiting: 1024 13407 1253.1 12827 19857
    Total: 1027 13407 1253.2 12827 19857

    Percentage of the requests served within a certain time (ms)
    50% 12827
    66% 13784
    75% 14249
    80% 14535
    90% 15274
    95% 15782
    98% 16355
    99% 16821
    100% 19857 (longest request)

    结果略好于源安装,总时间较短但单个请求消耗的时间分布更散一些,这个结果比较符合我心目中自己编译的效果(没有明显性能优势但应当和集中打包的二进制表现相当或者略好) @vibbow @yesono

    以及这次的两个结果明显比两年前的要好(物理机是同一台,而且我还专门找了老版本的 WordPress 来减少变量),说明程序本身的进步也不容忽视

    为了排除进程切换的影响,我正在用和脚本配置一样的 php 在源安装的机器上跑第三遍
    kenshin912
    kenshin912
    Apr 13, 2016
    48
    首先感谢楼主,目前 Oneinstack 用在生产环境上.
    我个人使用 Oneinstack 的时候,每次安装都要一个个选择,所以修改了 install.sh 并且删掉了很多不用的东西后重新打包了一下,楼主不会打我吧...
    yesono
    yesono
    OP
    Apr 13, 2016❤️1
    49
    @kenshin912 O(∩_∩)O 哈哈~ ,可以的。。。
    beyoung
    beyoung
    Apr 13, 2016
    50
    可以做几个预设的 环境 常见的组合 一个个选也的确略显麻烦
    yesono
    yesono
    OP
    Apr 13, 2016
    51
    @beyoung 后面会打成 rpm 包。
    zjxubinbin
    zjxubinbin
    Apr 13, 2016
    52
    特地来感谢楼主~
    zhs227
    zhs227
    Apr 13, 2016
    53
    在用,很好用,支持楼主!
    zhs227
    zhs227
    Apr 13, 2016
    54
    希望支持通过配置文件 provision 功能,不用交互输入。这样用在自动化环境上实现可复制安装。
    DIYgod
    DIYgod
    Apr 13, 2016
    55
    赞赞赞,我也在用,感谢~
    ivmm
    ivmm
    Apr 13, 2016
    56
    APCU 已经支持 PHP7 了
    yesono
    yesono
    OP
    Apr 13, 2016 via iPad
    57
    @zhs227 后期可以把参数写到一个文件 静默安装,更简单
    yesono
    yesono
    OP
    Apr 13, 2016 via iPad❤️1
    58
    @xrui 网站数据内容小于 1G (不包含数据库)会自动生成 tgz 包 大于 1g 压缩可能太消耗系统资源,数据备份是 rsync
    daiv
    daiv
    Apr 13, 2016
    59
    我也用过一次,感觉体验不错。

    以后继续用的时候,反馈一下体验。

    非常支持。毕竟军哥的 lnmp 更新慢,安装也慢
    Daddy
    Daddy
    Apr 13, 2016
    60
    留言感谢一下,一直在用你们的脚本在自己的 VPS 上
    whkvf
    whkvf
    Apr 13, 2016
    61
    这个要赞一下。
    guonning
    guonning
    Apr 13, 2016 via iPhone
    62
    在用,很好用
    ewBuyVmLZMZE
    ewBuyVmLZMZE
    Apr 13, 2016
    63
    嗯,加上 OpenResty 了?不枉我在你的 QA 里面留言建议。
    zetttt
    zetttt
    Apr 14, 2016
    64
    在用,感谢
    LeoSocks
    LeoSocks
    Apr 14, 2016 via Android
    65
    在用,非常不错啊
    yesono
    yesono
    OP
    Apr 14, 2016 via iPad
    66
    @syhily 很多人反馈就加上了
    fengtalk
    fengtalk
    Apr 14, 2016
    67
    不错!目前使用当中……
    AstroProfundis
    AstroProfundis
    Apr 14, 2016
    68
    在把源安装调整成和编译安装一样的 PHP 设置(进程数和 CPU 核数相同)之后,结果变成了源安装比编译安装略好

    PHP 配置:
    pm = dynamic
    pm.max_children = 4
    pm.start_servers = 2
    pm.min_spare_servers = 2
    pm.max_spare_servers = 4
    pm.process_idle_timeout = 10s
    pm.max_requests = 2048
    rlimit_files = 51200
    rlimit_core = 0

    结果:
    This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/

    Benchmarking x.x.x.167 (be patient)


    Server Software: nginx/1.8.1
    Server Hostname: x.x.x.167
    Server Port: 80

    Document Path: /?paged=2
    Document Length: 48526 bytes

    Concurrency Level: 50
    Time taken for tests: 6568.194 seconds
    Complete requests: 25000
    Failed requests: 0
    Total transferred: 1218625000 bytes
    HTML transferred: 1213150000 bytes
    Requests per second: 3.81 [#/sec] (mean)
    Time per request: 13136.388 [ms] (mean)
    Time per request: 262.728 [ms] (mean, across all concurrent requests)
    Transfer rate: 181.19 [Kbytes/sec] received

    Connection Times (ms)
    min mean[+/-sd] median max
    Connect: 0 0 0.1 0 3
    Processing: 1030 13123 514.0 13130 17304
    Waiting: 158 12224 499.5 12236 15666
    Total: 1033 13123 514.0 13130 17304

    Percentage of the requests served within a certain time (ms)
    50% 13130
    66% 13209
    75% 13258
    80% 13289
    90% 13381
    95% 13508
    98% 14403
    99% 15127
    100% 17304 (longest request)

    所以目前的结论是: php-fpm 的 max_children 要设置成和 CPU 核心数(逻辑核心 /进程数)相同
    yesono
    yesono
    OP
    Apr 14, 2016
    69
    @AstroProfundis 最优值不一定是这个,建议压测得出结果,可参考: https://blog.linuxeye.com/380.html
    xrui
    xrui
    Apr 14, 2016 via Android
    70
    @yesono 这样啊。。。辛苦了
    tangzhehao
    tangzhehao
    Apr 14, 2016
    71
    yeho 好~
    loser
    loser
    Apr 18, 2016
    72
    我试试。。。
    loser
    loser
    Apr 18, 2016
    73
    Complete!
    在 messagebus 服务中读取信息时出错:没有那个文件或目录
    在 irqbalance 服务中读取信息时出错:没有那个文件或目录
    在 syslog 服务中读取信息时出错:没有那个文件或目录
    setenforce: SELinux is disabled
    sed :无法读取 /etc/selinux/config :没有那个文件或目录
    hostname: 未知的主机
    sed: 无法重命名 /etc/sed6Nx5vR :设备或资源忙
    error: "Read-only file system" setting key "net.ipv4.ip_forward"
    error: "Read-only file system" setting key "net.ipv4.conf.default.rp_filter"
    error: "Read-only file system" setting key "net.ipv4.conf.default.accept_source_route"
    error: "Read-only file system" setting key "kernel.sysrq"
    error: "Read-only file system" setting key "kernel.core_uses_pid"
    error: "net.ipv4.tcp_syncookies" is an unknown key
    error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
    error: "net.bridge.bridge-nf-call-iptables" is an unknown key
    error: "net.bridge.bridge-nf-call-arptables" is an unknown key
    error: "Read-only file system" setting key "kernel.msgmnb"
    error: "Read-only file system" setting key "kernel.msgmax"
    error: "Read-only file system" setting key "kernel.shmmax"
    error: "Read-only file system" setting key "kernel.shmall"
    error: "Read-only file system" setting key "fs.file-max"
    error: "Read-only file system" setting key "fs.inotify.max_user_instances"
    error: "net.ipv4.tcp_fin_timeout" is an unknown key
    error: "net.ipv4.tcp_tw_reuse" is an unknown key
    error: "net.ipv4.tcp_tw_recycle" is an unknown key
    error: "Read-only file system" setting key "net.ipv4.ip_local_port_range"
    error: "net.ipv4.tcp_max_syn_backlog" is an unknown key
    error: "net.ipv4.tcp_max_tw_buckets" is an unknown key
    error: "net.ipv4.route.gc_timeout" is an unknown key
    error: "net.ipv4.tcp_syn_retries" is an unknown key
    error: "net.ipv4.tcp_synack_retries" is an unknown key
    error: "Read-only file system" setting key "net.core.somaxconn"
    error: "net.core.netdev_max_backlog" is an unknown key
    error: "net.ipv4.tcp_timestamps" is an unknown key
    error: "net.ipv4.tcp_max_orphans" is an unknown key
    sed :无法读取 /etc/sysconfig/i18n :没有那个文件或目录
    18 Apr 00:58:20 ntpdate[481]: Can't adjust the time of day: Operation not permitted
    grep: /var/spool/cron/root: 没有那个文件或目录
    Starting crond: [ OK ]
    iptables: Setting chains to policy ACCEPT: filter nat [ OK ]
    iptables: Flushing firewall rules: [ OK ]
    iptables: Unloading modules: iptable_filter iptable_nat ip[FAILED]lter iptable_nat ip_tables
    iptables: Applying firewall rules: [ OK ]





    来自网易蜂巢安装测试
    yesono
    yesono
    OP
    Apr 18, 2016
    74
    @loser 服务器好像有问题, Read-only file system 。。
    ug888168
    ug888168
    Apr 20, 2016 via Android
    75
    @loser 你服务器的文件只可读
    ibiner
    ibiner
    Jun 18, 2016
    76
    LZ 做的很到位,很好用。不知道 256M 的小 VPS 能 yong
    yesono
    yesono
    OP
    Jun 24, 2016
    77
    @ibiner 应该是可以的
    lyhiving
    lyhiving
    Dec 13, 2016
    78
    @yesono 不知道你有没有看这个回复,我目前在用 oneinstck ,感觉很不错。还是提个建议:
    1 、 nginx 编译的时候能不能加上个--with-http_sub_module ,每次都要手动添加,差点就 fork 后再改了。
    2 、 php 的升级不要一定是升级,其实我多次用来降级,感觉还是可以的。
    yesono
    yesono
    OP
    Dec 20, 2016
    79
    @lyhiving 已经在 options.conf 增加 nginx_modules_options='' 写上即可
    bbbbbbbk
    bbbbbbbk
    Apr 1, 2017
    80
    非常好用,受益匪浅,感谢
    songkqx1c
    songkqx1c
    May 15, 2017
    81
    oneinstack 怎么为网站正式域名添加一个测试地址呢
    superay
    superay
    Sep 12, 2017
    82
    支持一下,还没用过,准备试试。
    RorschachZZZ
    RorschachZZZ
    Oct 24, 2017
    83
    好用,点赞。
    artoostark
    artoostark
    Apr 15, 2018
    84
    @DIYgod 大佬你好
    kelestudio
    kelestudio
    Oct 18, 2018
    85
    提一个小问题.因为我服务器在国内.很多时候下载国外的源码包下载不下载,被墙了.
    这块能否考虑下,比如把很多包下载下来打包一个 full 安装包.或者 wget 的 URL 指定为国内的某个镜像点(比如某大学).
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1810 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 136ms · UTC 16:06 · PVG 00:06 · LAX 08:06 · JFK 11:06
    ♥ Do have faith in what you're doing.