diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..bc36a8e5
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,25 @@
+# http://editorconfig.org
+# 官网首页有介绍:IntelliJ IDEA,VS Code 默认就支持,无需额外安装插件
+root = true
+
+# 空格替代Tab缩进在各种编辑工具下效果一致
+[*]
+indent_style = space
+indent_size = 4
+charset = utf-8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
+max_line_length = 200
+
+
+
+[*.java]
+indent_style = tab
+
+[*.{json,yml}]
+indent_size = 2
+
+[*.md]
+insert_final_newline = false
+trim_trailing_whitespace = false
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..2cbbc96c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,36 @@
+build/
+out/
+log/
+logs/
+public/
+target/
+node_modules/
+classes/
+.deploy*/
+.gradle
+*.log.*
+*.log
+.DS_Store
+Thumbs.db
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
\ No newline at end of file
diff --git a/Bash-Other-Bash.md b/Bash-Other-Bash.md
deleted file mode 100644
index b9207941..00000000
--- a/Bash-Other-Bash.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Bash 其他常用命令
-
-## 其他常用命令
-
-- 编辑 hosts 文件:`vim /etc/hosts`,添加内容格式:`127.0.0.1 www.youmeek.com`
-- RPM 文件操作命令:
- - 安装
- - `rpm -i example.rpm`,安装 example.rpm 包
- - `rpm -iv example.rpm`,安装 example.rpm 包并在安装过程中显示正在安装的文件信息
- - `rpm -ivh example.rpm`,安装 example.rpm 包并在安装过程中显示正在安装的文件信息及安装进度
- - 查询
- - `rpm -qa | grep jdk`,查看 jdk 是否被安装
- - 卸载
- - `rpm -e jdk`,卸载 jdk(一般卸载的时候都要先用 rpm -qa 看下整个软件的全名)
-
-## 资料
-
-
diff --git a/CentOS-Install.md b/CentOS-Install.md
deleted file mode 100644
index 4982a38d..00000000
--- a/CentOS-Install.md
+++ /dev/null
@@ -1,116 +0,0 @@
-# CentOS 安装
-
-
-## 概括
-
-- 本教程中主要演示了 VirtualBox 和 VMware Workstation 下安装 `CentOS 6.6` 的过程。
-- VirtualBox 是免费开源,我个人在使用经历中遇到过很多次崩溃、安装有问题等,所以它不是我主推的虚拟机
-- VMware Workstation 是商业软件,很好用,一些辅助功能也很到位,主推该虚拟机。
-
-
-## VirtualBox 下安装 CentOS 过程
-
-- VirtualBox 的介绍和下载
- - 官网:
- - wiki:
- - 百度 wiki:
- - 百度云下载(32 位和 64 位一体):
- - 官网下载:
-
-
-- 安装细节开始:
- - 
- - 如上图标注 1 所示:点击 `新建` 一个虚拟机。
- - 如上图标注 2 所示:在填写 `名称` 的时候,输入 `CentOS` 相关字眼的时候,下面的版本类型会跟着变化,自动识别为 `Red Hat`
- - 
- - 如上图标注 1 所示:我们装的是 64 位系统,如果你本机内存足够大,建议可以给 2 ~ 4 G 的容量
- - 
- - 
- - 
- - 
- - 如上图所示,命名最好规范,最好要带上系统版本号,硬盘大小建议在 8 ~ 20 G
- - 
- - 如上图 gif 演示,当我们创建好虚拟机之后,需要选择模拟光驱进行系统镜像安装
- - 
- - 
- - 如上图箭头所示,我们这里选择 `Skip`,跳过对镜像的检查,这个一般需要检查很久,而且我们用 iso 文件安装的,一般没这个必要
- - 
- - 
- - 如上图标注 1 所示,建议 Linux 纯新手使用简体中文环境
- - 
- - 
- - 
- - 如上图标注 1 所示,因为我们是用全新的虚拟机,虚拟出来的硬盘都是空的,所以这里可以忽略所有数据
- - 
- - 
- - 
- - 再次强调下,root 账号也就是图上所说的 `根账号`,它是最顶级账号,密码最好别忘记了
- - 
- - 
- - 如上图标注 1 所示,因为我们是用全新的虚拟机,所以这里选择 `使用所有空间` ,然后 CentOS 会按它默认的方式进行分区
- - 
- - 
- - `Desktop` 代表:图形界面版,会默认安装很多软件,建议新手选择此模式,我后面其他文章的讲解都是基于此系统下,如果你不是此模式的系统可能在安装某些软件的时候会出现某些依赖包没有安装的情况
- - `basic sever` 代表:命令行界面,有良好基础的基本都会喜欢这个
- - 
- - 上一步我选择的是 `Desktop` 所以有很多软件需要安装,这个过程大概需要 5 ~ 10 分钟
- - 
- - 安装完成
- - 
- - 安装完成后一定要把盘片删除,防止系统启动的时候去读盘,重新进入安装系统模式
-
-
-## VMware 下安装 CentOS 过程
-
-- VMware Workstation 的介绍和下载
- - 官网:
- - wiki:
- - 百度 wiki:
- - 百度云下载(64 位):
- - 官网下载:
-
-
-- 安装细节开始:
- - 
- - 
- - 默认 VMware 选择的是 `典型` 我不推荐,我下面的步骤是选择 `自定义(高级)`。如果你非常了解 Linux 系统倒是可以考虑选择 `典型`,在它默认安装完的系统上可以很好地按你的需求进行修改
- - 
- - 
- - 牢记:不要在这一步就选择镜像文件,不然也会直接进入 `典型` 模式,直接按它的规则进行系统安装
- - 
- - 
- - 
- - 
- - 
- - 桥接模式:(建议选择此模式)创建一个独立的虚拟主机,在桥接模式下的虚拟主机网络一般要为其配 IP 地址、子网掩码、默认网关(虚拟机ip地址要与主机ip地址处于同网段)
- - NAT 模式:把物理主机作为路由器进行访问互联网,优势:联网简单,劣势:虚拟主机无法与物理主机通讯
- - 主机模式:把虚拟主机网络与真实网络隔开,但是各个虚拟机之间可以互相连接,虚拟机和物理机也可以连接
- - > 上面解释来源:
- - 
- - Buslogic 和 LSIlogic 都是虚拟硬盘 SCSI 设备的类型,旧版本的 OS 默认的是 Buslogic,LSIlogic 类型的硬盘改进了性能,对于小文件的读取速度有提高,支持非 SCSI 硬盘比较好。
- - > 上面解释来源:
- - 
- - 
- - 
- - 强烈建议至少要给 20 G,不然装不了多少软件的
- - 
- - 
- - 
- - 如上图 gif 所示,在创建完虚拟机之后,我们要加载系统镜像,然后启动虚拟机进行安装,接下来的安装步骤跟上面使用 VirtualBox 安装细节基本一样,不一样的地方是我这里选择的是自定义分区,不再是选择默认分区方式
- - 
- - 如上图箭头所示,这里我们选择自定义分区方式
- - 
- - 如上图 gif 所示,我只把最基本的区分出来,如果你有自己的需求可以自己设置
- - 简单分区方案:
- - `/boot` == 500 M(主分区)
- - `/swap` == 2 G(逻辑分区)一般大家的说法这个大小是跟你机子的内存大小相关的,也有说法内存大不需要这个,但是还是建议分,虚拟机内存 2 G,所以我分 2 G
- - `/` == 剩余容量(逻辑分区)剩余的空间都给了根分区
- - 
- - 
- - 
- - 
- - 
- - 
- - 
- - 
- - 
diff --git a/Crontab.md b/Crontab.md
deleted file mode 100644
index 0eba3f5e..00000000
--- a/Crontab.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Crontab 介绍
-
-
-## Crontab 安装
-
-- 查看是否已安装:
- - CentOS:`rpm -qa | grep cron`
- - Ubuntu:`dpkg -l | grep cron`
-
-- 安装(一般系统是集成的):
- - CentOS 6:`sudo yum install -y vixie-cron crontabs`
- - Ubuntu:`sudo apt-get install -y cron`
-
-## Crontab 服务器配置文件常用参数
-
-- 配置文件介绍(记得先备份):`sudo vim /etc/crontab`
- - 该配置格式解释:
- - 
- - 常用例子介绍:
- - 30 21 * * * service httpd restart #每晚的 21:30 重启 apache
- - 45 4 1,10,22 * * service httpd restart #每月的 1、10、22 日的 4:45 重启 apache
- - 45 4 1-10 * * service httpd restart #每月的 1 到 10 日的 4:45 重启 apache
- - */2 * * * * service httpd restart #每隔两分钟重启 apache
- - 1-59/2 * * * * service httpd restart #每隔两分钟重启 apache(这个比较特殊:1-59/2 这个表示过掉0分,从 1 分开始算,每隔两分执行,所以 1 分执行了,3 分执行了,5 分执行了....都是奇数进行执行。默认的 */2 都是偶数执行。)
- - 0 23-7/2 * * * service httpd restart #晚上 11 点到早上 7 点之间,每隔 2 个小时重启 apache
- - 0-59/30 18-23 * * * service httpd restart #每天 18:00 到 23:00 之间,每隔 30 分钟重启 apache(方法一)
- - 0,30 18-23 * * * service httpd restart #每天 18:00 到 23:00 之间,每隔 30 分钟重启 apache(方法二)
-- 执行记录日志:`cd /var/log/cron`
-
-## Crontab 资料
-
--
--
diff --git a/Jenkins-Install-And-Settings.md b/Jenkins-Install-And-Settings.md
deleted file mode 100644
index aed4b193..00000000
--- a/Jenkins-Install-And-Settings.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# Jenkins 安装和配置
-
-
-## Jenkins 安装
-
-- Jenkins 安装
- - 官网:
- - 官网帮助中心:
- - 官网使用 Tomcat 部署方式指导:
- - 此时(20160207) Jenkins 最新版本为:**1.647**
- - JDK 最低要求是 JDK 7,官网推荐是 JDK 8
- - 我个人习惯 `/opt` 目录下创建一个目录 `setups` 用来存放各种软件安装包;在 `/usr` 目录下创建一个 `program` 用来存放各种解压后的软件包,下面的讲解也都是基于此习惯
- - 我个人已经使用了第三方源:`EPEL、RepoForge`,如果你出现 `yum install XXXXX` 安装不成功的话,很有可能就是你没有相关源,请查看我对源设置的文章
- - Jenkins 下载:`wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war` (大小:61 M)
- - 我们假设这个 Tomcat 就是为了 Jenkins 专用的
- - 把下载下来的 jenkins.war 移到 Tomcat 的 webapps 目录下,比如我的是:`/usr/program/tomcat8/webapps`
- - 把 Jenkins.war 改名为 ROOT.war:`mv jenkins.war ROOT.war`
- - 删除 Tomcat 下 webapps 目录下多余的一些目录
- - 首次启动 Tomcat,让 Tomcat 解压 war
- - 设置 JENKINS_HOME:
- - 寻找 jenkins home 目录地址:`find / -name .jenkins`,我这边得到的结果是:`/root/.jenkins`
- - 对在 Tomcat 文章中讲解的系统变量 `CATALINA_OPTS` 进行设置:
- - 旧值:
- ```
- CATALINA_OPTS="-server -Xms528m -Xmx528m -XX:PermSize=256m -XX:MaxPermSize=358m"
- export CATALINA_OPTS
- ```
- - 改为:
- ```
- CATALINA_OPTS="-server -DJENKINS_HOME=/root/.jenkins -Xms528m -Xmx528m -XX:PermSize=256m -XX:MaxPermSize=358m"
- export CATALINA_OPTS
- ```
-
-
-- Jenkins 各个组件配置:
- - 访问:
-
-
-- 其他问题
- - 如果访问的时候报这个异常:`java.net.UnknownHostException`,可以查看这篇文章:
-
-
-## 资料
-
--
\ No newline at end of file
diff --git a/Jira-Install-And-Settings.md b/Jira-Install-And-Settings.md
deleted file mode 100644
index d29df51c..00000000
--- a/Jira-Install-And-Settings.md
+++ /dev/null
@@ -1,42 +0,0 @@
-# Jira 安装和配置
-
-
-## Jira 安装
-
-- Jira 安装
- - 官网:
- - 官网下载:
- - 中文在线试用:
- - 官网帮助说明:
- - 官网中文语言包:
- - Jira 6.3.6 网盘下载:
- - Jira 6.3.6 中文语言包网盘下载:
- - 环境要求:
- - JDK 7 或更新版本;
- - Mysql
- - 我们要使用的版本:**atlassian-jira-6.3.6.tar.gz**
- - 我个人习惯 `/opt` 目录下创建一个目录 `setups` 用来存放各种软件安装包;在 `/usr` 目录下创建一个 `program` 用来存放各种解压后的软件包,下面的讲解也都是基于此习惯
- - 我个人已经使用了第三方源:`EPEL、RepoForge`,如果你出现 `yum install XXXXX` 安装不成功的话,很有可能就是你没有相关源,请查看我对源设置的文章
- - 解压:`tar zxvf atlassian-jira-6.3.6.tar.gz`
- - 修改目录名:`mv atlassian-jira-6.3.6/ jira6.3.6/`
- - 移到我个人的安装目录下:`mv jira6.3.6/ /usr/program/`
- - 创建存放数据目录:`mkdir -p /usr/program/jira6.3.6/data/`
- - 设置环境变量:
- - 编辑:`vim /etc/profile`
- - 在文件尾部添加:
- ``` ini
- JIRA_HOME=/usr/program/jira6.3.6/data/
- export JIRA_HOME
- ```
- - 刷新配置:`source /etc/profile`
- - 运行:`/usr/program/jira6.3.6/bin/start-jira.sh`
- - 访问:`http://192.168.0.111:8080/`
- - 汉化:`cp JIRA-6.3.6-language-pack-zh_CN.jar /usr/program/jira6.3.6/atlassian-jira/WEB-INF/lib/`
- - 配置过程:
- - 
- - 
- - 
- - 
- - 
- - 
- - 重新激活页面地址:`http://192.168.0.111:8090/secure/admin/ViewLicense.jspa`
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..23cb7903
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ {description}
+ Copyright (C) {year} {fullname}
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ {signature of Ty Coon}, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/Maven-Install-And-Settings.md b/Maven-Install-And-Settings.md
deleted file mode 100644
index 6a432db7..00000000
--- a/Maven-Install-And-Settings.md
+++ /dev/null
@@ -1,155 +0,0 @@
-# Maven 安装和配置
-
-
-
-## Maven 安装
-
-- Maven 安装
- - 官网:
- - 官网下载:
- - 历史版本下载:
- - 此时(20160208) Maven 最新版本为:**3.3.9**
- - Maven 3.3 的 JDK 最低要求是 JDK 7
- - 我个人习惯 `/opt` 目录下创建一个目录 `setups` 用来存放各种软件安装包;在 `/usr` 目录下创建一个 `program` 用来存放各种解压后的软件包,下面的讲解也都是基于此习惯
- - 我个人已经使用了第三方源:`EPEL、RepoForge`,如果你出现 `yum install XXXXX` 安装不成功的话,很有可能就是你没有相关源,请查看我对源设置的文章
- - 下载压缩包:`wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz`
- - 解压:`tar zxvf apache-maven-3.3.9-bin.tar.gz`
- - 修改目录名,默认的太长了:`mv apache-maven-3.3.9/ maven3.3.9/`
- - 移到我个人习惯的安装目录下:`mv maven3.3.9/ /usr/program`
- - 环境变量设置:`vim /etc/profile`
- - 在文件最尾巴添加下面内容:
-
- ``` ini
- # Maven
- MAVEN_HOME=/usr/program/maven3.3.9
- PATH=$PATH:$MAVEN_HOME/bin
- MAVEN_OPTS="-Xms256m -Xmx356m"
- export MAVEN_HOME
- export PATH
- export MAVEN_OPTS
- ```
-
- - 刷新配置文件:`source /etc/profile`
- - 测试是否安装成功:`mvn -version`
-
-
-## Maven 配置
-
-- 配置项目连接上私服
-- 全局方式配置:
-
-``` xml
-
-
-
-
-
- D:/maven/my_local_repository
-
-
-
-
-
-
-
-
-
-
- nexus-releases
- admin
- admin123
-
-
- nexus-snapshots
- admin
- admin123
-
-
-
-
-
-
- nexus-releases
- *
- http://localhost:8081/nexus/content/groups/public
-
-
- nexus-snapshots
- *
- http://localhost:8081/nexus/content/groups/public-snapshots
-
-
-
-
-
-
- nexus
-
-
- nexus-releases
- http://nexus-releases
-
- true
-
-
- true
-
-
-
- nexus-snapshots
- http://nexus-snapshots
-
- true
-
-
- true
-
-
-
-
-
- nexus-releases
- http://nexus-releases
-
- true
-
-
- true
-
-
-
- nexus-snapshots
- http://nexus-snapshots
-
- true
-
-
- true
-
-
-
-
-
-
-
- nexus
-
-
-
-```
-
-- 项目级别:
-
-
-
-
-## 资料
-
--
--
--
--
--
--
--
--
\ No newline at end of file
diff --git a/Mysql-Install-And-Settings.md b/Mysql-Install-And-Settings.md
deleted file mode 100644
index efbabd43..00000000
--- a/Mysql-Install-And-Settings.md
+++ /dev/null
@@ -1,169 +0,0 @@
-# MySQL 安装和配置
-
-
-## MySQL 安装
-
-- Mysql 安装
- - 官网:
- - 官网下载:
- - 官网 5.5 下载:
- - 官网 5.6 下载:
- - 官网 5.7 下载:
- - 官网帮助中心:
- - 此时(20160210) Mysql 5.5 最新版本为:**5.5.48**
- - 此时(20160210) Mysql 5.6 最新版本为:**5.6.29**
- - 此时(20160210) Mysql 5.7 最新版本为:**5.7.11**
- - 我个人习惯 `/opt` 目录下创建一个目录 `setups` 用来存放各种软件安装包;在 `/usr` 目录下创建一个 `program` 用来存放各种解压后的软件包,下面的讲解也都是基于此习惯
- - 我个人已经使用了第三方源:`EPEL、RepoForge`,如果你出现 `yum install XXXXX` 安装不成功的话,很有可能就是你没有相关源,请查看我对源设置的文章
- - Mysql 5.6 下载:`wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.29.tar.gz` (大小:31 M)
- - Mysql 5.7 下载:`wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.11.tar.gz` (大小:47 M)
- - 我们这次安装以 5.6 为实例
- - 进入下载目录:`cd /opt/setups`
- - 解压压缩包:`tar zxvf mysql-5.6.29.tar.gz`
- - 移到解压包:`mv /opt/setups/mysql-5.6.29 /usr/program/`
- - 安装依赖包、编译包:`yum install -y make gcc-c++ cmake bison-devel ncurses-devel`
- - 进入解压目录:`cd /usr/program/mysql-5.6.29/`
- - 生成安装目录:`mkdir -p /usr/program/mysql/data`
- - 生成配置(使用 InnoDB):`sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/program/mysql -DMYSQL_DATADIR=/usr/program/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1`
- - 更多参数说明可以查看:
- - 编译:`sudo make`,这个过程比较漫长,一般都在 30 分钟左右,具体还得看机子配置,如果最后结果有 error,建议删除整个 mysql 目录后重新解压一个出来继续处理
- - 安装:`sudo make install`
- - 配置开机启动:
- - `sudo cp /usr/program/mysql-5.6.29/support-files/mysql.server /etc/init.d/mysql`
- - `sudo chmod 755 /etc/init.d/mysql`
- - `sudo chkconfig mysql on`
- - 复制一份配置文件: `sudo cp /usr/program/mysql-5.6.29/support-files/my-default.cnf /etc/my.cnf`
- - 删除安装的目录:`rm -rf /usr/program/mysql-5.6.29/`
- - 添加组和用户及安装目录权限
- - `sudo groupadd mysql` #添加组
- - `sudo useradd -g mysql mysql -s /bin/false` #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统
- - `sudo chown -R mysql:mysql /usr/program/mysql/data` #设置MySQL数据库目录权限
- - 初始化数据库:`sudo /usr/program/mysql/scripts/mysql_install_db --basedir=/usr/program/mysql --datadir=/usr/program/mysql/data --skip-name-resolve --user=mysql`
- - 开放防火墙端口:
- - `sudo iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT`
- - `sudo service iptables save`
- - `sudo service iptables restart`
- - 禁用 selinux
- - 编辑配置文件:`vim /etc/selinux/config`
- - 把 `SELINUX=enforcing` 改为 `SELINUX=disabled`
- - 常用命令软连接,才可以在终端直接使用:mysql 和 mysqladmin 命令
- - `sudo ln -s /usr/program/mysql/bin/mysql /usr/bin`
- - `sudo ln -s /usr/program/mysql/bin/mysqladmin /usr/bin`
-
-
-## MySQL 配置
-
-- 官网配置参数解释:
-- 找一下当前系统中有多少个 my.cnf 文件:`find / -name "my.cnf"`,我查到的结果:
-
-``` nginx
-/etc/my.cnf
-/usr/program/mysql/my.cnf
-/usr/program/mysql/mysql-test/suite/ndb/my.cnf
-/usr/program/mysql/mysql-test/suite/ndb_big/my.cnf
-.............
-/usr/program/mysql/mysql-test/suite/ndb_rpl/my.cnf
-```
-
-
-- 保留 **/etc/my.cnf** 和 **/usr/program/mysql/mysql-test/** 目录下配置文件,其他删除掉。
-- 我整理的一个单机版配置说明(MySQL 5.6,适用于 1G 内存的服务器):
- - [my.cnf](MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-comprehensive.cnf)
-
-## 修改 root 账号密码
-
-- 启动 Mysql 服务器:`service mysql start`
-- 查看是否已经启动了:`ps aux | grep mysql`
-- 默认安装情况下,root 的密码是空,所以为了方便我们可以设置一个密码,假设我设置为:123456
-- 终端下执行:`mysql -uroot`
- - 现在进入了 mysql 命令行管理界面,输入:`SET PASSWORD = PASSWORD('123456');`
-- 修改密码后,终端下执行:`mysql -uroot -p`
- - 根据提示,输入密码进度 mysql 命令行状态。
-- 如果你在其他机子上连接该数据库机子报:**Access denied for user 'root'@'localhost' (using password: YES)**
- - 解决办法:
- - 在终端中执行:`service mysql stop`
- - 在终端中执行:`/usr/program/mysql/bin/mysqld --skip-grant-tables`
- - 此时 MySQL 服务会一直处于监听状态,你需要另起一个终端窗口来执行接下来的操作
- - 在终端中执行:`mysql -u root mysql`
- - 进入 MySQL 命令后执行:`UPDATE user SET Password=PASSWORD('填写你要的新密码') where USER='root';FLUSH PRIVILEGES;`
- - 重启 MySQL 服务:`service mysql restart`
-
-
-
-## MySQL 主从复制
-
-### 环境说明和注意点
-
-- 假设有两台服务器,一台做主,一台做从
- - MySQL 主信息:
- - IP:**12.168.1.113**
- - 端口:**3306**
- - MySQL 从信息:
- - IP:**12.168.1.115**
- - 端口:**3306**
-- 注意点
- - 主 DB server 和从 DB server 数据库的版本一致
- - 主 DB server 和从 DB server 数据库数据一致
- - 主 DB server 开启二进制日志,主 DB server 和从 DB server 的 server-id 都必须唯一
-- 优先操作:
- - **把主库的数据库复制到从库并导入**
-
-### 主库机子操作
-
-- 主库操作步骤
- - 创建一个目录:`mkdir -p /usr/program/mysql/data/mysql-bin`
- - 主 DB 开启二进制日志功能:`vim /etc/my.cnf`,
- - 添加一行:`log-bin = /usr/program/mysql/data/mysql-bin`
- - 指定同步的数据库,如果不指定则同步全部数据库,其中 ssm 是我的数据库名:`binlog-do-db=ssm`
- - 主库关掉慢查询记录,用 SQL 语句查看当前是否开启:`SHOW VARIABLES LIKE '%slow_query_log%';`,如果显示 OFF 则表示关闭,ON 表示开启
- - 重启主库 MySQL 服务
- - 进入 MySQL 命令行状态,执行 SQL 语句查询状态:`SHOW MASTER STATUS;`
- - 在显示的结果中,我们需要记录下 **File** 和 **Position** 值,等下从库配置有用。
- - 设置授权用户 slave01 使用 123456 密码登录主库,这里 @ 后的 IP 为从库机子的 IP 地址,如果从库的机子有多个,我们需要多个这个 SQL 语句。
-
- ``` SQL
- grant replication slave on *.* to 'slave01'@'192.168.1.135' identified by '123456';
- flush privileges;
- ```
-
-
-### 从库机子操作
-
-
-- 从库操作步骤
- - 从库开启慢查询记录,用 SQL 语句查看当前是否开启:`SHOW VARIABLES LIKE '%slow_query_log%';`,如果显示 OFF 则表示关闭,ON 表示开启。
- - 测试从库机子是否能连上主库机子:`sudo mysql -h 192.168.1.105 -u slave01 -p`,必须要连上下面的操作才有意义。
- - 由于不能排除是不是系统防火墙的问题,所以建议连不上临时关掉防火墙:`service iptables stop`
- - 或是添加防火墙规则:
- - 添加规则:`sudo iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT`
- - 保存规则:`sudo service iptables save`
- - 重启 iptables:`sudo service iptables restart`
- - 修改配置文件:`vim /etc/my.cnf`,把 server-id 改为跟主库不一样
- - 在进入 MySQL 的命令行状态下,输入下面 SQL:
-
- ``` SQL
- CHANGE MASTER TO
- master_host='192.168.1.113',
- master_user='slave01',
- master_password='123456',
- master_port=3306,
- master_log_file='mysql3306-bin.000006',>>>这个值复制刚刚让你记录的值
- master_log_pos=1120;>>>这个值复制刚刚让你记录的值
- ```
-
-- 执行该 SQL 语句,启动 slave 同步:`START SLAVE;`
-- 执行该 SQL 语句,查看从库机子同步状态:`SHOW SLAVE STATUS;`
-- 在查看结果中必须下面两个值都是 Yes 才表示配置成功:
- - `Slave_IO_Running:Yes`
- - 如果不是 Yes 也不是 No,而是 Connecting,那就表示从机连不上主库,需要你进一步排查连接问题。
- - `Slave_SQL_Running:Yes`
-- 如果你的 Slave_IO_Running 是 No,一般如果你是在虚拟机上测试的话,从库的虚拟机是从主库的虚拟机上复制过来的,那一般都会这样的,因为两台的 MySQL 的 UUID 值一样。你可以检查从库下的错误日志:`cat /usr/program/mysql/data/mysql-error.log`
- - 如果里面提示 uuid 错误,你可以编辑从库的这个配置文件:`vim /usr/program/mysql/data/auto.cnf`,把配置文件中的:server-uuid 值随便改一下,保证和主库是不一样即可。
-
-
-
-
-
-## 资料
-
--
\ No newline at end of file
diff --git a/Mysql-Optimize.md b/Mysql-Optimize.md
deleted file mode 100644
index 15038ed3..00000000
--- a/Mysql-Optimize.md
+++ /dev/null
@@ -1,120 +0,0 @@
-# MySQL 优化
-
-
-- 下面说的优化基于 MySQL 5.6,理论上 5.5 之后的都算试用,具体还是要看官网
-
-## 服务状态查询
-
-- 查看当前数据库的状态,常用的有:
- - 查看当前MySQL中已经记录了多少条慢查询,前提是配置文件中开启慢查询记录了.
- - `SHOW STATUS LIKE '%slow_queries%';`
- - 查询当前MySQL中查询、更新、删除执行多少条了,可以通过这个来判断系统是侧重于读还是侧重于写,如果是写要考虑使用读写分离。
- - `SHOW STATUS LIKE '%Com_select%';`
- - `SHOW STATUS LIKE '%Com_update%';`
- - `SHOW STATUS LIKE '%Com_delete%';`
- - 显示MySQL服务启动运行了多少时间,如果MySQL服务重启,该时间重新计算,单位秒
- - `SHOW STATUS LIKE 'uptime';`
-
-
-
-## 查询优化
-
-- 使用 EXPLAIN 进行 SQL 语句分析:`EXPLAIN SELECT * FROM sys_user;`
-- 得到的结果有下面几列:
- - id,该列表示当前结果序号,无特殊意义,不重要
- - select_type,表示 SELECT 语句的类型,有下面几种
- - SIMPLE,表示简单查询,其中不包括连接查询和子查询
- - PRIMARY,表示主查询,或者是最外面的查询语句。比如你使用一个子查询语句,比如这条 SQL:`EXPLAIN SELECT * FROM (SELECT sys_user_id FROM sys_user WHERE sys_user_id = 1) AS temp_table;`
- - 这条 SQL 有两个结果,其中有一个结果的类型就是 PRIMARY
- - UNION,使用 UNION 的SQL是这个类型
- - DERIVED,在 SQL 中 From 后面子查询
- - SUBQUERY,子查询
- - 还有其他一些
- - table,表名或者是子查询的一个结果集
- - type,表示表的链接类型,分别有(以下的连接类型的顺序是从最佳类型到最差类型)**(这个属性重要)**:
- - 性能好:
- - system,表仅有一行,这是const类型的特列,平时不会出现,这个也可以忽略不计。
- - const,数据表最多只有一个匹配行,因为只匹配一行数据,所以很快,常用于PRIMARY KEY或者UNIQUE索引的查询,可理解为const是最优化的。
- - eq_ref,mysql手册是这样说的:"对于每个来自于前面的表的行组合,从该表中读取一行。这可能是最好的联接类型,除了const类型。它用在一个索引的所有部分被联接使用并且索引是UNIQUE(唯一键)也不是PRIMARY KEY(主键)"。eq_ref可以用于使用=比较带索引的列。
- - ref,查询条件索引既不是UNIQUE(唯一键)也不是PRIMARY KEY(主键)的情况。ref可用于=或<或>操作符的带索引的列。
- - ref_or_null,该联接类型如同ref,但是添加了MySQL可以专门搜索包含NULL值的行。在解决子查询中经常使用该联接类型的优化。
- - 性能较差:
- - index_merge,该联接类型表示使用了索引合并优化方法。在这种情况下,key列包含了使用的索引的清单,key_len包含了使用的索引的最长的关键元素。
- - unique_subquery,该类型替换了下面形式的IN子查询的ref: `value IN (SELECT primary_key FROM single_table WHERE some_expr)`。unique_subquery 是一个索引查找函数,可以完全替换子查询,效率更高。
- - index_subquery,该联接类型类似于unique_subquery。可以替换IN子查询,但只适合下列形式的子查询中的非唯一索引: `value IN (SELECT key_column FROM single_table WHERE some_expr)`
- - range,只检索给定范围的行,使用一个索引来选择行。
- - index,该联接类型与ALL相同,除了只有索引树被扫描。这通常比ALL快,因为索引文件通常比数据文件小。
- - 性能最差:
- - ALL,对于每个来自于先前的表的行组合,进行完整的表扫描。(性能最差)
- - possible_keys,指出MySQL能使用哪个索引在该表中找到行。如果该列为NULL,说明没有使用索引,可以对该列创建索引来提供性能。**(这个属性重要)**
- - key,显示MySQL实际决定使用的键(索引)。如果没有选择索引,键是NULL。**(这个属性重要)**
- - key_len,显示MySQL决定使用的键长度。如果键是NULL,则长度为NULL。注意:key_len是确定了MySQL将实际使用的索引长度。
- - ref,显示使用哪个列或常数与key一起从表中选择行。
- - rows,显示MySQL认为它执行查询时必须检查的行数。**(这个属性重要)**
- - Extra,该列包含MySQL解决查询的详细信息:
- - Distinct:MySQL发现第1个匹配行后,停止为当前的行组合搜索更多的行。
- - Not exists:MySQL能够对查询进行LEFT JOIN优化,发现1个匹配LEFT JOIN标准的行后,不再为前面的的行组合在该表内检查更多的行。
- - range checked for each record (index map: #):MySQL没有发现好的可以使用的索引,但发现如果来自前面的表的列值已知,可能部分索引可以使用。
- - Using filesort:MySQL需要额外的一次传递,以找出如何按排序顺序检索行。
- - Using index:从只使用索引树中的信息而不需要进一步搜索读取实际的行来检索表中的列信息。
- - Using temporary:为了解决查询,MySQL需要创建一个临时表来容纳结果。
- - Using where:WHERE 子句用于限制哪一个行匹配下一个表或发送到客户。
- - Using sort_union(...), Using union(...), Using intersect(...):这些函数说明如何为index_merge联接类型合并索引扫描。
- - Using index for group-by:类似于访问表的Using index方式,Using index for group-by表示MySQL发现了一个索引,可以用来查 询GROUP BY或DISTINCT查询的所有列,而不要额外搜索硬盘访问实际的表。
-- 了解对索引不生效的查询情况 **(这个属性重要)**
- - 使用LIKE关键字的查询,在使用LIKE关键字进行查询的查询语句中,如果匹配字符串的第一个字符为“%”,索引不起作用。只有“%”不在第一个位置,索引才会生效。
- - 使用联合索引的查询,MySQL可以为多个字段创建索引,一个索引可以包括16个字段。对于联合索引,只有查询条件中使用了这些字段中第一个字段时,索引才会生效。
- - 使用OR关键字的查询,查询语句的查询条件中只有OR关键字,且OR前后的两个条件中的列都是索引列时,索引才会生效,否则,索引不生效。
-- 子查询优化
- - MySQL从4.1版本开始支持子查询,使用子查询进行SELECT语句嵌套查询,可以一次完成很多逻辑上需要多个步骤才能完成的SQL操作。
- - 子查询虽然很灵活,但是执行效率并不高。
- - 执行子查询时,MYSQL需要创建临时表,查询完毕后再删除这些临时表,所以,子查询的速度会受到一定的影响。
- - 优化:
- - 可以使用连接查询(JOIN)代替子查询,连接查询时不需要建立临时表,其速度比子查询快。
-
-
-## 数据库结构优化
-
-- 将字段很多的表分解成多个表
- - 对于字段较多的表,如果有些字段的使用频率很低,可以将这些字段分离出来形成新表。
- - 因为当一个表的数据量很大时,会由于使用频率低的字段的存在而变慢。
-- 增加中间表
- - 对于需要经常联合查询的表,可以建立中间表以提高查询效率。
- - 通过建立中间表,将需要通过联合查询的数据插入到中间表中,然后将原来的联合查询改为对中间表的查询。
-- 增加冗余字段
- - 设计数据表时应尽量遵循范式理论的规约,尽可能的减少冗余字段,让数据库设计看起来精致、优雅。但是,合理的加入冗余字段可以提高查询速度。
-
-
-
-## 插入数据的优化(适用于 InnoDB)
-
-- 插入数据时,影响插入速度的主要是索引、唯一性校验、一次插入的数据条数等。
-- 开发环境情况下的考虑:
- - 开发场景中,如果需要初始化数据,导入数据等一些操作,而且是开发人员进行处理的,可以考虑在插入数据之前,先禁用整张表的索引,
- - 禁用索引使用 SQL:`ALTER TABLE table_name DISABLE KEYS;`
- - 当导入完数据之后,重新让MySQL创建索引,并开启索引:`ALTER TABLE table_name ENABLE KEYS;`
- - 如果表中有字段是有唯一性约束的,可以先禁用,然后在开启:
- - 禁用唯一性检查的语句:`SET UNIQUE_CHECKS = 0;`
- - 开启唯一性检查的语句:`SET UNIQUE_CHECKS = 1;`
- - 禁用外键检查(建议还是少量用外键,而是采用代码逻辑来处理)
- - 插入数据之前执行禁止对外键的检查,数据插入完成后再恢复,可以提供插入速度。
- - 禁用:`SET foreign_key_checks = 0;`
- - 开启:`SET foreign_key_checks = 1;`
- - 使用批量插入数据
- - 禁止自动提交
- - 插入数据之前执行禁止事务的自动提交,数据插入完成后再恢复,可以提供插入速度。
- - 禁用:`SET autocommit = 0;`
- - 开启:`SET autocommit = 1;`
-
-
-
-## 服务器优化
-
-- 好硬件大家都知道,这里没啥好说
-- 通过优化 MySQL 的参数可以提高资源利用率,从而达到提高 MySQL 服务器性能的目的。
- - 可以看我整理的这篇文章:
-
-
-## 资料
-
-
diff --git a/NTP.md b/NTP.md
deleted file mode 100644
index 4ce9bb55..00000000
--- a/NTP.md
+++ /dev/null
@@ -1,43 +0,0 @@
-## NTP(Network Time Protocol)介绍
-
-
-
-## NTP 安装
-
-- 查看是否已安装:
- - CentOS:`rpm -qa | grep ntp-*`
- - Ubuntu:`dpkg -l | grep ntp-*`
-
-- 安装:
- - CentOS 6:`sudo yum install -y ntp`
- - Ubuntu:`sudo apt-get install -y ntp`
-
-## NTP 服务器配置文件常用参数
-
-- 世界上可以校对时间节点:
-- 中国时间校对服务器节点:
-- 配置文件介绍(记得先备份):`sudo vim /etc/ntp.conf`
- - 
- - 该配置解释:
- - 标注 1 是默认内容,我们这里进行了注释。
- - 标注 2 是新增内容,表示使用中国时间校对服务器节点地址。
- ``` nginx
- server 0.asia.pool.ntp.org
- server 1.asia.pool.ntp.org
- server 2.asia.pool.ntp.org
- server 3.asia.pool.ntp.org
- ```
-- 启动服务:
- - `sudo service ntpd start`
-- 服务加到启动项
- - CentOS 系统
- - `sudo chkconfig ntpd on`
- - Ubuntu 系统
- - `sudo apt-get install -y sysv-rc-conf `
- - `sudo sysv-rc-conf ntpd on`
-
-## NTP 资料
-
--
--
--
diff --git a/Nginx-Install-And-Settings.md b/Nginx-Install-And-Settings.md
deleted file mode 100644
index ae0f45a7..00000000
--- a/Nginx-Install-And-Settings.md
+++ /dev/null
@@ -1,466 +0,0 @@
-# Nginx 安装和配置
-
-
-## Nginx 说明
-
-- Nginx 是一个很强大的高性能 Web 和反向代理服务器,常被我们用作负载均衡服务器,也可以作为邮件代理服务器
-- Nginx WIKI:
-- Nginx 百科:
-- Nginx 官网:
-- Nginx 官网下载:
- - 源码包方式下载:,注意该页面的:`Stable version`,这个表示稳定版本,2016-03-22 最新版本是:`nginx-1.8.1`,这是一个 **tar.gz** 的文件链接。
- - 构建包方式下载:
-- Nginx 文档:
- - 优先:
- - 次要:
-- Nginx 模块地址:
-
-
-## 来自网络上的一个好介绍
-
-- 来源:
-
-> - 传统上基于进程或线程模型架构的 Web 服务通过每进程或每线程处理并发连接请求,这势必会在网络和 I/O 操作时产生阻塞,其另一个必然结果则是对内存或 CPU 的利用率低下。生成一个新的进程/线程需要事先备好其运行时环境,这包括为其分配堆内存和栈内存,以及为其创建新的执行上下文等。这些操作都需要占用 CPU,而且过多的进程/线程还会带来线程抖动或频繁的上下文切换,系统性能也会由此进一步下降。
-> - 在设计的最初阶段,Nginx 的主要着眼点就是其高性能以及对物理计算资源的高密度利用,因此其采用了不同的架构模型。受启发于多种操作系统设计中基于“事件”的高级处理机制,nginx采用了模块化、事件驱动、异步、单线程及非阻塞的架构,并大量采用了多路复用及事件通知机制。在 Nginx 中,连接请求由为数不多的几个仅包含一个线程的进程 Worker 以高效的回环(run-loop)机制进行处理,而每个 Worker 可以并行处理数千个的并发连接及请求。
-> - 如果负载以 CPU 密集型应用为主,如 SSL 或压缩应用,则 Worker 数应与 CPU 数相同;如果负载以 IO 密集型为主,如响应大量内容给客户端,则 Worker 数应该为 CPU 个数的 1.5 或 2 倍。
-> - Nginx会按需同时运行多个进程:一个主进程(Master)和几个工作进程(Worker),配置了缓存时还会有缓存加载器进程(Cache Loader)和缓存管理器进程(Cache Manager)等。所有进程均是仅含有一个线程,并主要通过“共享内存”的机制实现进程间通信。主进程以root用户身份运行,而 Worker、Cache Loader 和 Cache manager 均应以非特权用户身份运行。
-> - 主进程主要完成如下工作:
- - 1.读取并验正配置信息;
- - 2.创建、绑定及关闭套接字;
- - 3.启动、终止及维护worker进程的个数;
- - 4.无须中止服务而重新配置工作特性;
- - 5.控制非中断式程序升级,启用新的二进制程序并在需要时回滚至老版本;
- - 6.重新打开日志文件,实现日志滚动;
- - 7.编译嵌入式perl脚本;
-> - Worker 进程主要完成的任务包括:
- - 1.接收、传入并处理来自客户端的连接;
- - 2.提供反向代理及过滤功能;
- - 3.nginx任何能完成的其它任务;
-> - Cache Loader 进程主要完成的任务包括:
- - 1.检查缓存存储中的缓存对象;
- - 2.使用缓存元数据建立内存数据库;
-> - Cache Manager 进程的主要任务:
- - 1.缓存的失效及过期检验;
-
-
-
-## Nginx 源码编译安装
-
-- 官网下载最新稳定版本 **1.8.1**,大小:814K
-- 官网安装说明:
-- 源码编译配置参数说明:
- -
- -
-- 开始安装:
- - 安装依赖包:`yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel`
- - 预设几个文件夹,方便等下安装的时候有些文件可以进行存放:
- - `mkdir -p /usr/local/nginx /var/log/nginx /var/temp/nginx /var/lock/nginx`
- - 下载源码包:``wget http://nginx.org/download/nginx-1.8.1.tar.gz`
- - 解压:`tar zxvf nginx-1.8.1.tar.gz`
- - 进入解压后目录:`cd nginx-1.8.1/`
- - 编译配置:
-
- ``` ini
- ./configure \
- --prefix=/usr/local/nginx \
- --pid-path=/var/local/nginx/nginx.pid \
- --lock-path=/var/lock/nginx/nginx.lock \
- --error-log-path=/var/log/nginx/error.log \
- --http-log-path=/var/log/nginx/access.log \
- --with-http_gzip_static_module \
- --http-client-body-temp-path=/var/temp/nginx/client \
- --http-proxy-temp-path=/var/temp/nginx/proxy \
- --http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
- --http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
- --http-scgi-temp-path=/var/temp/nginx/scgi
- ```
-
- - 编译:`make`
- - 安装:`make install`
-- 启动 Nginx
- - 先检查是否在 /usr/local 目录下生成了 Nginx 等相关文件:`cd /usr/local/nginx;ll`,正常的效果应该是显示这样的:
-
- ``` nginx
- drwxr-xr-x. 2 root root 4096 3月 22 16:21 conf
- drwxr-xr-x. 2 root root 4096 3月 22 16:21 html
- drwxr-xr-x. 2 root root 4096 3月 22 16:21 sbin
- ```
-
- - 停止防火墙:`service iptables stop`
- - 或是把 80 端口加入到的排除列表:
- - `sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT`
- - `sudo service iptables save`
- - `sudo service iptables restart`
- - 启动:`/usr/local/nginx/sbin/nginx`,启动完成 shell 是不会有输出的
- - 检查 时候有 Nginx 进程:`ps aux | grep nginx`,正常是显示 3 个结果出来
- - 检查 Nginx 是否启动并监听了 80 端口:`netstat -ntulp | grep 80`
- - 访问:`192.168.1.114`,如果能看到:`Welcome to nginx!`,即可表示安装成功
- - 检查 Nginx 启用的配置文件是哪个:`/usr/local/nginx/sbin/nginx -t`
- - 刷新 Nginx 配置后重启:`/usr/local/nginx/sbin/nginx -s reload`
- - 停止 Nginx:`/usr/local/nginx/sbin/nginx -s stop`
- - 如果访问不了,或是出现其他信息看下错误立即:`vim /var/log/nginx/error.log`
-
-
-## 把 Nginx 添加到系统服务中
-
-- 新建文件:`vim /etc/init.d/nginx`
-- 添加如下内容:
-
-``` nginx
-#!/bin/bash
-
-
-#nginx执行程序路径需要修改
-nginxd=/usr/local/nginx/sbin/nginx
-
-# nginx配置文件路径需要修改
-nginx_config=/usr/local/nginx/conf/nginx.conf
-
-# pid 地址需要修改
-nginx_pid=/var/local/nginx/nginx.pid
-
-
-RETVAL=0
-prog="nginx"
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-# Source networking configuration.
-. /etc/sysconfig/network
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
-[ -x $nginxd ] || exit 0
-
-# Start nginx daemons functions.
-start() {
-if [ -e $nginx_pid ];then
- echo "nginx already running...."
- exit 1
-fi
-
-echo -n $"Starting $prog: "
-daemon $nginxd -c ${nginx_config}
-RETVAL=$?
-echo
-[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
-return $RETVAL
-}
-
-# Stop nginx daemons functions.
-# pid 地址需要修改
-stop() {
- echo -n $"Stopping $prog: "
- killproc $nginxd
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/local/nginx/nginx.pid
-}
-
-# reload nginx service functions.
-reload() {
- echo -n $"Reloading $prog: "
- #kill -HUP `cat ${nginx_pid}`
- killproc $nginxd -HUP
- RETVAL=$?
- echo
-}
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- reload)
- reload
- ;;
- restart)
- stop
- start
- ;;
- status)
- status $prog
- RETVAL=$?
- ;;
- *)
-
- echo $"Usage: $prog {start|stop|restart|reload|status|help}"
- exit 1
-
-esac
-exit $RETVAL
-```
-
-- 修改权限:`chmod 755 /etc/init.d/nginx`
-- 启动服务:`service nginx start`
-- 停止服务:`service nginx stop`
-- 重启服务:`service nginx restart`
-
-
-## Nginx 配置
-
-- Nginx 默认配置文件:`vim /usr/local/nginx/conf/nginx.conf`
-
-### Nginx 在 1.8.1 版本下的默认配置(去掉注释)
-
-``` nginx
-worker_processes 1;
-
-events {
- worker_connections 1024;
-}
-
-http {
- include mime.types;
- default_type application/octet-stream;
-
- sendfile on;
- keepalive_timeout 65;
-
- server {
- listen 80;
- server_name localhost;
-
- location / {
- root html;
- index index.html index.htm;
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
-}
-```
-
-### HTTP 服务,虚拟主机
-
-- 停止防火墙:`service iptables stop`,防止出现特别干扰
-- 编辑默认的配置文件:`vim /usr/local/nginx/conf/nginx.conf`
-- 设置两个虚拟主机(通过**端口**来区分开)
-
-``` nginx
-worker_processes 1;
-
-events {
- worker_connections 1024;
-}
-
-http {
- include mime.types;
- default_type application/octet-stream;
-
- sendfile on;
- keepalive_timeout 65;
-
- # 一个 server 代表一个虚拟主机
- server {
- listen 80;
- server_name localhost;
-
- location / {
- # 虚拟机根目录是 /usr/local/nginx/html 目录
- root html;
- # 虚拟机首页是 /usr/local/nginx/html 目录下这两个文件
- index index.html index.htm;
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
-
- server {
- # 第二个虚拟机的端口是 90,服务地址还是本地
- listen 90;
- server_name localhost;
-
- location / {
- root html90;
- index index.html index.htm;
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
-}
-```
-
-- 设置两个虚拟主机(通过**域名**来区分开)
-
-``` nginx
-worker_processes 1;
-
-events {
- worker_connections 1024;
-}
-
-http {
- include mime.types;
- default_type application/octet-stream;
-
- sendfile on;
- keepalive_timeout 65;
-
- # 一个 server 代表一个虚拟主机
- server {
- listen 80;
- # 两个虚拟主机都使用 80 端口,设置不同域名
- server_name code.youmeek.com;
-
- location / {
- # 虚拟机根目录是 /usr/local/nginx/html 目录
- root html;
- # 虚拟机首页是 /usr/local/nginx/html 目录下这两个文件
- index index.html index.htm;
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
-
- server {
- listen 80;
- # 两个虚拟主机都使用 80 端口,设置不同域名
- server_name i.youmeek.com;
-
- location / {
- root html-i;
- index index.html index.htm;
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
-}
-```
-
-
-### 反向代理和负载均衡
-
-- 最精简的环境:一台虚拟机
- - 1 个 JDK
- - 1 个 Nginx
- - 2 个 Tomcat
-
-- Nginx 配置:
-
-``` nginx
-worker_processes 1;
-
-events {
- worker_connections 1024;
-}
-
-http {
- include mime.types;
- default_type application/octet-stream;
-
- sendfile on;
- keepalive_timeout 65;
-
- # 自己定义的两个 tomcat 请求地址和端口
- # 也就是当浏览器请求:tomcat.youmeek.com 的时候从下面这两个 tomcat 中去找一个进行转发
- upstream tomcatCluster {
- server 192.168.1.114:8080;
- server 192.168.1.114:8081;
-
- # 添加 weight 字段可以表示权重,值越高权重越大,默认值是 1,最大值官网没说,一般如果设置也就设置 3,5,7 这样的数
- # 官网:https://www.nginx.com/resources/admin-guide/load-balancer/#weight
- # server 192.168.1.114:8080 weight=2;
- # server 192.168.1.114:8081 weight=1;
- }
-
- server {
- listen 80;
- server_name tomcat.youmeek.com;
-
- location / {
- proxy_pass http://tomcatCluster;
- index index.html index.htm;
- }
- }
-}
-```
-
-### HTTP 服务,绑定多个域名
-
--
-
-
-### 安装第三方模块
-
-### 生成规格图
-
-### 启用 Gzip 压缩
-
-
-### 防盗链
-
--
-
-
-### Nginx 禁止特定用户代理(User Agents)访问,静止指定 IP 访问
-
--
--
-- <>
-- <>
-- <>
-
-### Nginx 缓存
-
-
-### Nginx 自动分割日志文件
-
-
-
-### Nginx 处理跨域请求
-
-
-### 安全相预防
-
-
-在配置文件中设置自定义缓存以限制缓冲区溢出攻击的可能性
-client_body_buffer_size 1K;
-client_header_buffer_size 1k;
-client_max_body_size 1k;
-large_client_header_buffers 2 1k;
-
-7. 将timeout设低来防止DOS攻击
-所有这些声明都可以放到主配置文件中。
-client_body_timeout 10;
-client_header_timeout 10;
-keepalive_timeout 5 5;
-send_timeout 10;
-
-
-8. 限制用户连接数来预防DOS攻击
-limit_zone slimits $binary_remote_addr 5m;
-limit_conn slimits 5;
-
-
-
-### 杂七杂八
-
-- [nginx实现简体繁体字互转以及中文转拼音](https://www.ttlsa.com/nginx/nginx-modules-ngx_set_cconv/)
-- [nginx记录分析网站响应慢的请求(ngx_http_log_request_speed)](https://www.ttlsa.com/nginx/nginx-modules-ngx_http_log_request_speed/)
-- [nginx空白图片(empty_gif模块)](https://www.ttlsa.com/nginx/nginx-modules-empty_gif/)
-
-
-
-## 资料
-
--
--
-
diff --git a/README.md b/README.md
index 5d2a6977..80bf6ad0 100644
--- a/README.md
+++ b/README.md
@@ -1,108 +1,42 @@
-# Java 程序员眼中的 Linux
+
+## 作者新方向,感谢支持
+
+- [从开公司到开发全平台产品(文字版)](https://github.com/cdk8s/cdk8s-team-style/blob/master/full-stack/README.md)
+- [从开公司到开发全平台产品(视频版)](https://space.bilibili.com/1765486559/channel/seriesdetail?sid=2359281)
## 初衷(Original Intention)
-- 整理下自己所学
+- 整理下自己所学。**但是比较随意,所以很多地方不够严谨,所以请带着批评的思维阅读。**
- 带动更多的人进入 Linux 世界,特别是做 Java 开发的人
- Github 项目地址,欢迎 `Fork`、`Star`:
- 文章中用到的一些安装包归纳整理:
+- Gitbook 在线阅读地址:
- **学得越多越是明白一个人的力量是不够的,我只是起了一个引子,希望你能一起参与,真心希望!!!(鞠躬)**
+## 优秀同行推荐
-## 目录(Contents)
-
-- [Linux 介绍](Linux.md)
-- [Ubuntu 介绍](Ubuntu.md)
-- [Ubuntu 安装](Ubuntu-Install.md)
-- [Ubuntu 设置(目录)](ubuntu-settings/ubuntu-settings-toc.md)
-- [CentOS 介绍](CentOS.md)
-- [CentOS 安装](CentOS-Install.md)
-- [CentOS 设置(目录)](centos-settings/centos-settings-toc.md)
-- [Ubuntu 安装 VMware](Ubuntu-Install-VMware.md)
-- [VMware 克隆 CentOS 后网卡信息修改](CentOS-Virtual-Machine-Copy-Settings.md)
-- [Vim 安装、配置、快捷键列表](Vim-Install-And-Settings.md)
-- [Bash 命令](Bash.md)
-- [Bash 其他常用命令](Bash-Other-Bash.md)
-- [Linux 下常用压缩文件的解压、压缩](File-Extract-Compress.md)
-- [Yum 下载安装包及对应依赖包](Off-line-Yum-Install.md)
-- [Zsh 入门](Zsh.md)
-- [nmon 系统性能监控工具](Nmon.md)
-- [SSH(Secure Shell)介绍](SSH.md)
-- [FTP(File Transfer Protocol)介绍](FTP.md)
-- [VPN(Virtual Private Network)介绍](VPN.md)
-- [NFS(Network FileSystem)介绍](NFS.md)
-- [NTP(Network Time Protocol)介绍](NTP.md)
-- [Samba 介绍](Samba.md)
-- [Crontab 介绍](Crontab.md)
-- [Iptables 介绍](Iptables.md)
-- [花生壳-安装介绍](Hsk-Install.md)
-- [JDK 安装](JDK-Install.md)
-- [SVN 安装和配置](SVN-Install-And-Settings.md)
-- [Tomcat 安装和配置、优化](Tomcat-Install-And-Settings.md)
-- [Jenkins 安装和配置](Jenkins-Install-And-Settings.md)
-- [Maven 安装和配置](Maven-Install-And-Settings.md)
-- [Nexus 安装和配置](Nexus-Install-And-Settings.md)
-- [MySQL 安装和配置](Mysql-Install-And-Settings.md)
-- [MySQL 优化](Mysql-Optimize.md)
-- [MySQL 教程](Mysql-Tutorial.md)
-- [Redis 安装和配置](Redis-Install-And-Settings.md)
-- [Solr 安装和配置](Solr-Install-And-Settings.md)
-- [Jira 安装和配置](Jira-Install-And-Settings.md)
-- [Jenkins 安装和配置](Jenkins-Install-And-Settings.md)
-- [TeamCity 安装和配置](TeamCity-Install-And-Settings.md)
-- [Nginx 安装和配置](Nginx-Install-And-Settings.md)
-- [FastDFS 安装和配置](FastDFS-Install-And-Settings.md)
-- [FastDFS 结合 GraphicsMagick](FastDFS-Nginx-Lua-GraphicsMagick.md)
-- [RabbitMQ 安装和配置](RabbitMQ-Install-And-Settings.md)
-- [Openfire 安装和配置](Openfire-Install-And-Settings.md)
-- [Rap 安装和配置](Rap-Install-And-Settings.md)
-- [Nginx + Keepalived 高可用](Nginx-Keepalived-Install-And-Settings.md)
-- [黑客入侵检查](Was-Hacked.md)
-
-
-## 下一步(Next)
-
-- Apache 安装和配置
-- LVS + Keepalived 高可用
-- MySQL + Keepalived 高可用
-- Zookeeper 安装和配置
-- ActiveMQ 服务安装和配置
-- GitLab 安装和配置
-- Zabbix 安装和配置
-- Nagios 安装和配置
-- Docker 安装和配置
-- ShadowSocks 安装和配置
-- Tmux 安装和配置
-- sed 学习
-- 常用脚本
-
-## 联系(Contact)
+- [Linux工具快速教程](http://linuxtools-rst.readthedocs.io/zh_CN/latest/base/index.html)
-- Email:judas.n@qq.com(常用) or admin@youmeek.com(备用)
-- Blog:
-- 欢迎捐赠 ^_^:
-
-
-## Github 协同视频教程(Participate)
-
-- 如果您不会使用 Git 或是 Github 也没关系,请认真学习下面视频教程:
-- Judas.n 录制
- - 视频格式:MP4
- - 分辨率:1920 X 1080
- - 片长:16 min
- - 文件大小:62 M
-- 下载
- - 百度云盘:
- - 360 网盘(2fb5):
-
-## Github 常用按钮说明
-
-- Watch:关注该项目,作者有更新的时候,会在你的 Github 主页有通知消息。
-- Star:收藏该项目,在你的头像上有一个“Your stars”链接,可以看到你的收藏列表。
-- Fork:复制一份项目到的Github空间上,你可以自己开发自己的这个地址项目,然后 Pull Request 给项目原主人。
-
-## 参与作者汇总(Author)
+## 目录(Contents)
-|作者(按参与时间排序)|地址|
-|:---------|:---------|
-|Judas.n||
+- [Linux 介绍](markdown-file/Linux.md)
+- [Ubuntu 介绍](markdown-file/Ubuntu.md)
+- [Ubuntu 安装](markdown-file/Ubuntu-Install.md)
+- [Ubuntu 设置(目录)](markdown-file/ubuntu-settings/ubuntu-settings-toc.md)
+- [Kali Linux 介绍和设置(目录)](markdown-file/kali-linux-settings/kali-linux-toc.md)
+- [CentOS 介绍](markdown-file/CentOS.md)
+- [CentOS 6 安装](markdown-file/CentOS-Install.md)
+- [CentOS 7 安装](markdown-file/CentOS-7-Install.md)
+- [CentOS 6 和 CentOS 7 差异](markdown-file/CentOS6-and-CentOS7.md)
+- [CentOS 设置(目录)](markdown-file/centos-settings/centos-settings-toc.md)
+- [Ubuntu 安装 VMware](markdown-file/Ubuntu-Install-VMware.md)
+- [VMware 克隆 CentOS 后网卡信息修改](markdown-file/CentOS-Virtual-Machine-Copy-Settings.md)
+- [Vim 安装、配置、快捷键列表](markdown-file/Vim-Install-And-Settings.md)
+- [SSH 免密登录](markdown-file/SSH-login-without-password.md)
+- [Bash 命令](markdown-file/Bash.md)
+- [Bash 其他常用命令](markdown-file/Bash-Other-Bash.md)
+- [安装的 rm(删除)](markdown-file/shell-safe-rm.md)
+- [Sed 命令](markdown-file/Sed.md)
+- [Linux 下常用压缩文件的解压、压缩](markdown-file/File-Extract-Compress.md)
+- [Yum 下载安装包及对应依赖包](markdown-file/Off-line-Yum-Install.md)
+- [Zsh 入门](markdown-file/Zsh.md)
diff --git a/RabbitMQ-Install-And-Settings.md b/RabbitMQ-Install-And-Settings.md
deleted file mode 100644
index 449d0a97..00000000
--- a/RabbitMQ-Install-And-Settings.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# RabbitMQ 安装和配置
-
-
-## RabbitMQ 说明
-
-- MQ 全称为 Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法。应用程序通过读写出入队列的消息(针对应用程序的数据)来通信,而无需专用连接来链接它们。
- - RabbitMQ 是一个在 AMQP 基础上完整的,可复用的企业消息系统。他遵循 Mozilla Public License 开源协议。
-- RabbitMQ WIKI:
-- RabbitMQ 百科:
-- RabbitMQ 官网:
-- RabbitMQ 官网下载:
-- RabbitMQ 官网安装文档:
-- RabbitMQ 文档:
- - 优先:
- - 次要:
-
-
-## 先安装 Erlang
-
-- 有 EPEL 源的情况(需要安装的内容较多,宽带要能跟上):`sudo yum install erlang`
-- RabbitMQ 官网提供 Erlang 安装包:
- - 下载地址:
- - 下载好之后,安装下面两个文件:
- - `sudo yum localinstall -y esl-erlang_18.1-1~centos~6_amd64.rpm`
- - `sudo yum localinstall -y esl-erlang-compat-18.1-1.noarch.rpm`
-
-
-## 安装 RabbitMQ
-
-- 此时(2016-04),最新版:**3.6.1**
-- 安装:`rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc`
-- 安装:`sudo yum install -y rabbitmq-server-3.6.1-1.noarch.rpm`
-- 启动服务:
- - 先看下自己的主机名:`hostname`,我的主机名是:**judasnHost2**
- - 先修改一下 host 文件:`vim /etc/hosts`,添加一行:`127.0.0.1 judasnHost2`(必须这样做)
- - 启动:`service rabbitmq-server start`,启动一般都比较慢,所以别急
- - 停止:`service rabbitmq-server stop`
- - 重启:`service rabbitmq-server restart`
- - 设置开机启动:`chkconfig rabbitmq-server on`
-
-
-## 配置
-
-- 查找默认配置位置:`find / -name "rabbitmq.config.example"`,我这边搜索结果是:`/usr/share/doc/rabbitmq-server-3.6.1/rabbitmq.config.example`
-- 复制默认配置:`cp /usr/share/doc/rabbitmq-server-3.6.1/rabbitmq.config.example /etc/rabbitmq/`
-- 修改配置文件名:`cd /etc/rabbitmq ; mv rabbitmq.config.example rabbitmq.config`
-- 编辑配置文件,开启用户远程访问:`vim rabbitmq.config`
- - 在 64 行,默认有这样一句话:`%% {loopback_users, []},`,注意,该语句最后有一个逗号,等下是要去掉的
- - 我们需要改为:`{loopback_users, []}`,
-- 开启 Web 界面管理:`rabbitmq-plugins enable rabbitmq_management`
-- 重启 RabbitMQ 服务:`service rabbitmq-server restart`
-- 开放防火墙端口:
- - `sudo iptables -I INPUT -p tcp -m tcp --dport 15672 -j ACCEPT`
- - `sudo iptables -I INPUT -p tcp -m tcp --dport 5672 -j ACCEPT`
- - `sudo service iptables save`
- - `sudo service iptables restart`
-- 浏览器访问:`http://192.168.1.114:15672`
- 默认管理员账号:**guest**
- 默认管理员密码:**guest**
-- 添加新授权用户(如下图所示):
- - 
-- 添加 Host(如下图所示):
- - 
-- 给添加的 Host 设置权限(如下图所示):
- - 
-- 交换机绑定队列(如下图所示):
- - 
diff --git a/Redis-Install-And-Settings.md b/Redis-Install-And-Settings.md
deleted file mode 100644
index af6e849a..00000000
--- a/Redis-Install-And-Settings.md
+++ /dev/null
@@ -1,181 +0,0 @@
-## Redis 安装和配置
-
-
-
-## Redis 安装
-
-- Redis 安装
- - 官网:
- - 官网下载:
- - 官网 Github 地址:
- - 此时(20160212) Redis 最新稳定版本为:**3.0.7**
- - 官网帮助中心:
- - 我个人习惯 `/opt` 目录下创建一个目录 `setups` 用来存放各种软件安装包;在 `/usr` 目录下创建一个 `program` 用来存放各种解压后的软件包,下面的讲解也都是基于此习惯
- - 我个人已经使用了第三方源:`EPEL、RepoForge`,如果你出现 `yum install XXXXX` 安装不成功的话,很有可能就是你没有相关源,请查看我对源设置的文章
- - Redis 下载:`wget http://download.redis.io/releases/redis-3.0.7.tar.gz` (大小:1.4 M)
- - 安装依赖包:`yum install -y gcc-c++ tcl`
- - 解压:`tar zxvf redis-3.0.7.tar.gz`
- - 移动到我个人安装目录:`mv redis-3.0.7/ /usr/program/`
- - 进入解压后目录:`cd /usr/program/redis-3.0.7/`
- - 编译:`make`
- - 编译安装:`make install`
- - 安装完之后会在:`/usr/local/bin` 目录下生成好几个 redis 相关的文件
- - 复制配置文件:`cp /usr/program/redis-3.0.7/redis.conf /etc/`
- - 修改配置:`vim /etc/redis.conf`
- - 把旧值:`daemonize no`
- - 改为新值:`daemonize yes`
- - 启动:`/usr/local/bin/redis-server /etc/redis.conf`
- - 查看是否启动:`ps -ef | grep redis`
- - 进入客户端:`redis-cli`
- - 关闭客户端:`redis-cli shutdown`
- - 开机启动配置:`echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.local`
- - 开放防火墙端口:
- - 添加规则:`sudo iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT`
- - 保存规则:`sudo /etc/rc.d/init.d/iptables save`
- - 重启 iptables:`sudo service iptables restart`
-
-
-## Redis 配置
-
-- 编辑配置文件:`vim /usr/program/redis-3.0.7/redis.conf`
-- Redis 默认的配置文件内容:
-
-``` ini
-# 是否以后台daemon方式运行,默认是 no,一般我们会改为 yes
-daemonize no
-pidfile /var/run/redis.pid
-port 6379
-tcp-backlog 511
-timeout 0
-tcp-keepalive 0
-loglevel notice
-logfile ""
-# 开启数据库的数量,Redis 是有数据库概念的,默认是 16 个,数字从 0 ~ 15
-databases 16
-save 900 1
-save 300 10
-save 60 10000
-stop-writes-on-bgsave-error yes
-rdbcompression yes
-rdbchecksum yes
-dbfilename dump.rdb
-dir ./
-slave-serve-stale-data yes
-slave-read-only yes
-repl-diskless-sync no
-repl-diskless-sync-delay 5
-repl-disable-tcp-nodelay no
-slave-priority 100
-appendonly no
-appendfilename "appendonly.aof"
-appendfsync everysec
-no-appendfsync-on-rewrite no
-auto-aof-rewrite-percentage 100
-auto-aof-rewrite-min-size 64mb
-aof-load-truncated yes
-lua-time-limit 5000
-slowlog-log-slower-than 10000
-slowlog-max-len 128
-latency-monitor-threshold 0
-notify-keyspace-events ""
-hash-max-ziplist-entries 512
-hash-max-ziplist-value 64
-list-max-ziplist-entries 512
-list-max-ziplist-value 64
-set-max-intset-entries 512
-zset-max-ziplist-entries 128
-zset-max-ziplist-value 64
-hll-sparse-max-bytes 3000
-activerehashing yes
-client-output-buffer-limit normal 0 0 0
-client-output-buffer-limit slave 256mb 64mb 60
-client-output-buffer-limit pubsub 32mb 8mb 60
-hz 10
-aof-rewrite-incremental-fsync yes
-```
-
-
-## Redis 常用命令
-
-- 命令是不区分大小写的,但是这里为了方便和后面的 key value 进行区分所以我全部写大写,你也可以用小写。
- - 但是需要注意的是:key 是完全区分大小写的,比如 key=codeBlog 和 key=codeblog 是两个键值
-- 官网命令列表:
-- `SET key value`,设值。eg:`SET myblog www.youmeek.com`
-- `GET key`,取值
-- `INCR key`,递增数字
-- `DECR key`,递减数字
-- `KEYS *`,查看当前数据库下所有的 key
-- `APPEND key value`,给尾部追加内容,如果要追加的 key 不存在,则相当于 SET key value
-- `STRLEN key`,返回键值的长度,如果键不存在则返回 0
-- `MSET key1 value1 key2 value2`,同时设置多值
-- `MGET key1 value1 key2 value2`,同时取多值
-- `EXPIRE key 27`,设置指定键的生存时间,27 的单位是秒
-- `TTL key`,查看键的剩余生存时间
- - 返回 -2,表示不存在,过了生存时间后被删除
- - 返回 -1,表示没有生存时间,永久存储
- - 返回正整数,表示还剩下对应的生存时间
-- `PERSIST key`,清除生成时间,重新变成永久存储(重新设置 key 的值也可以起到清除生存时间的效果)
-- `FLUSHDB`,清空当前数据库所有键值
-- `FLUSHALL`,清空所有数据库的所有键值
-
-
-## Redis 客户端
-
-- Java:
- - Jedis 官网:
-
-
-
-## Redis GUI 管理工具
-
-- Redis Desktop Manager
- - 官网:
- - 官网下载:
- - 效果如下图:
- - 
-
-
-
-## Redis 主从(主从从)配置
-
-### Redis 主从架构
-
-- 假设有两台服务器,一台做主,一台做从
- - Redis 主信息:
- - IP:**12.168.1.114**=
- - 端口:**6379**
- - Redis 从信息:
- - IP:**12.168.1.115**
- - 端口:**6379**
-- 编辑从机的 Redis 配置文件,找到 210 行(大概),默认这一行应该是注释的:`# slaveof `
-- 我们需要去掉该注释,并且填写我们自己的主机的 IP 和 端口,比如:`slaveof 192.168.1.114 6379`
-- 配置完成后重启从机 Redis 服务
-- 重启完之后,进入主机的 redis-cli 状态下,输入:`INFO replication`
- - 可以查询到当前主机的 redis 处于什么角色,有哪些从机已经连上主机。
-- 此时已经完成了主从配置,我们可以测试下:
- - 我们进入主机的 redis-cli 状态,然后 set 某个值,比如:`set myblog YouMeek.com`
-- 我们切换进入从机的 redis-cli 的状态下,获取刚刚设置的值看是否存在:`get myblog`,此时,我们可以发现是可以获取到值的。
-- 但是有一个需要注意的:从库不具备写入数据能力,不然会报错。 从库只有只读能力。
-
-
-### Redis主从从架构
-
-- Redis 主从从的意思:看桌面上的截图。
-- 优点,除了减少主库连接的压力,还有可以关掉主库的持久化功能,把持久化的功能交给从库进行处理。
-- 第一个从库配置的信息是连上主库,后面的第二个从库配置的连接信息是连上第一个从库, 假如还有第三个从库的话,我们可以把第三个从库的配置信息连上第二个从库上,以此类推。
-
-
-
-
-
-
-
-
-
-
-## 资料
-
--
--
--
--
\ No newline at end of file
diff --git a/SSH.md b/SSH.md
deleted file mode 100644
index 46280ae9..00000000
--- a/SSH.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# SSH(Secure Shell)介绍
-
-
-
-## SSH 安装
-
-- 查看是否已安装:
- - CentOS:`rpm -qa | grep openssh`
- - Ubuntu:`dpkg -l | grep openssh`
-
-- 安装:
- - CentOS 6:`sudo yum install -y openssh-server openssh-clients`
- - Ubuntu:`sudo apt-get install -y openssh-server openssh-client`
-
-## SSH 配置文件常用参数
-
-- 配置文件介绍(记得先备份):`sudo vim /etc/ssh/sshd_config`
- - Port 22 #默认指定 22 端口,可以自己修改
- - Protocol 2,1 #指定了 SSH 协议版本,目前 SSH 只有两个版本 2 和 1
- - PasswordAuthentication yes #是否开启密码验证,因为 SSH 也可以设置秘钥类授权登录的方式,如果用这种方式我们可以考虑关掉密码登录的方式。
- - PermitEmptyPasswords no #是否允许密码为空,与上面参数配合用。
-
-## SSH 允许 root 账户登录
-
-- 编辑配置文件(记得先备份):`sudo vim /etc/ssh/sshd_config`
- - 允许 root 账号登录
- - 注释掉:`PermitRootLogin without-password`
- - 新增一行:`PermitRootLogin yes`
-
-## SSH 密钥登录
-
-- 生成秘钥和公钥文件,命令:`sudo ssh-keygen`,在交互提示中连续按三次回车,如果看得懂交互的表达,那就根据你自己需求来。默认生成密钥和公钥文件是在:/root/.ssh。
-- 进入生成目录:`cd /root/.ssh`,可以看到有两个文件:id_rsa (私钥) 和 id_rsa.pub (公钥)
-- 在 .ssh 目录下创建 SSH 认证文件,命令:`touch /root/.ssh/authorized_keys`
-- 将公钥内容写到SSH认证文件里面,命令:`cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys`
-- 修改SSH认证文件权限,命令:
- - `sudo chmod 700 /root/.ssh`
- - `sudo chmod 600 /root/.ssh/authorized_keys`
-- 重启服务:`sudo service ssh restart`
-- 设置 SSH 服务默认启动:`sudo sysv-rc-conf ssh on`
-
-现在 SSH 客户端可以去拿着 SSH 服务器端上的 id_rsa,在客户端指定秘钥文件地址即可,这个一般由于你使用的客户端决定的,我这里推荐的是 Xshell 软件。
-
-## SSH 资料
-
--
diff --git a/SUMMARY.md b/SUMMARY.md
new file mode 100644
index 00000000..d034445b
--- /dev/null
+++ b/SUMMARY.md
@@ -0,0 +1,95 @@
+# Java 程序员眼中的 Linux
+
+* [Linux 介绍](markdown-file/Linux.md)
+* [Ubuntu 介绍](markdown-file/Ubuntu.md)
+* [Ubuntu 安装](markdown-file/Ubuntu-Install.md)
+* [Ubuntu 设置(目录)](markdown-file/ubuntu-settings/ubuntu-settings-toc.md)
+* [Kali Linux 介绍和设置(目录)](markdown-file/kali-linux-settings/kali-linux-toc.md)
+* [CentOS 介绍](markdown-file/CentOS.md)
+* [CentOS 6 安装](markdown-file/CentOS-Install.md)
+* [CentOS 7 安装](markdown-file/CentOS-7-Install.md)
+* [CentOS 6 和 CentOS 7 差异](markdown-file/CentOS6-and-CentOS7.md)
+* [CentOS 设置(目录)](markdown-file/centos-settings/centos-settings-toc.md)
+* [Ubuntu 安装 VMware](markdown-file/Ubuntu-Install-VMware.md)
+* [VMware 克隆 CentOS 后网卡信息修改](markdown-file/CentOS-Virtual-Machine-Copy-Settings.md)
+* [Vim 安装、配置、快捷键列表](markdown-file/Vim-Install-And-Settings.md)
+* [SSH 免密登录](markdown-file/SSH-login-without-password.md)
+* [Bash 命令](markdown-file/Bash.md)
+* [Bash 其他常用命令](markdown-file/Bash-Other-Bash.md)
+* [安装的 rm(删除)](markdown-file/shell-safe-rm.md)
+* [Sed 命令](markdown-file/Sed.md)
+* [Linux 下常用压缩文件的解压、压缩](markdown-file/File-Extract-Compress.md)
+* [Yum 下载安装包及对应依赖包](markdown-file/Off-line-Yum-Install.md)
+* [Zsh 入门](markdown-file/Zsh.md)
+* [终端测速](markdown-file/speedtest.md)
+* [日常维护](markdown-file/maintenance.md)
+* [日常监控](markdown-file/monitor.md)
+* [nmon 系统性能监控工具](markdown-file/Nmon.md)
+* [Glances 安装和配置](markdown-file/Glances-Install-And-Settings.md)
+* [SSH(Secure Shell)介绍](markdown-file/SSH.md)
+* [FTP(File Transfer Protocol)介绍](markdown-file/FTP.md)
+* [VPN(Virtual Private Network)介绍](markdown-file/VPN.md)
+* [NFS(Network FileSystem)介绍](markdown-file/NFS.md)
+* [NTP(Network Time Protocol)介绍](markdown-file/NTP.md)
+* [Samba 介绍](markdown-file/Samba.md)
+* [Crontab 介绍](markdown-file/Crontab.md)
+* [Iptables 介绍](markdown-file/Iptables.md)
+* [花生壳-安装介绍](markdown-file/Hsk-Install.md)
+* [JDK 安装](markdown-file/JDK-Install.md)
+* [Java bin 目录下的工具](markdown-file/Java-bin.md)
+* [SVN 安装和配置](markdown-file/SVN-Install-And-Settings.md)
+* [Tomcat 安装和配置、优化](markdown-file/Tomcat-Install-And-Settings.md)
+* [Jenkins 安装和配置](markdown-file/Jenkins-Install-And-Settings.md)
+* [Maven 安装和配置](markdown-file/Maven-Install-And-Settings.md)
+* [Nexus 安装和配置](markdown-file/Nexus-Install-And-Settings.md)
+* [PostgreSQL 安装和配置](markdown-file/PostgreSQL-Install-And-Settings.md)
+* [MySQL 安装和配置](markdown-file/Mysql-Install-And-Settings.md)
+* [MySQL 优化](markdown-file/Mysql-Optimize.md)
+* [MySQL 测试](markdown-file/Mysql-Test.md)
+* [MySQL 教程](markdown-file/Mysql-Tutorial.md)
+* [Percona XtraDB Cluster(PXC)安装和配置](markdown-file/PXC-Install-And-Settings.md)
+* [Redis 安装和配置](markdown-file/Redis-Install-And-Settings.md)
+* [MongoDB 安装和配置](markdown-file/MongoDB-Install-And-Settings.md)
+* [Solr 安装和配置](markdown-file/Solr-Install-And-Settings.md)
+* [Jira 安装和配置](markdown-file/Jira-Install-And-Settings.md)
+* [Confluence 安装和配置](markdown-file/Confluence-Install-And-Settings.md)
+* [Jenkins 安装和配置](markdown-file/Jenkins-Install-And-Settings.md)
+* [TeamCity 安装和配置](markdown-file/TeamCity-Install-And-Settings.md)
+* [Nginx 安装和配置](markdown-file/Nginx-Install-And-Settings.md)
+* [wrk 安装和配置](markdown-file/wrk-Install-And-Settings.md)
+* [FastDFS 安装和配置](markdown-file/FastDFS-Install-And-Settings.md)
+* [FastDFS 结合 GraphicsMagick](markdown-file/FastDFS-Nginx-Lua-GraphicsMagick.md)
+* [RabbitMQ 安装和配置](markdown-file/RabbitMQ-Install-And-Settings.md)
+* [Openfire 安装和配置](markdown-file/Openfire-Install-And-Settings.md)
+* [Rap 安装和配置](markdown-file/Rap-Install-And-Settings.md)
+* [Nginx + Keepalived 高可用](markdown-file/Nginx-Keepalived-Install-And-Settings.md)
+* [黑客入侵检查](markdown-file/Was-Hacked.md)
+* [Shadowsocks 安装和配置](markdown-file/http://code.youmeek.com/2016/08/19/2016/08/VPS/)
+* [Mycat 安装和配置](markdown-file/Mycat-Install-And-Settings.md)
+* [Zookeeper 安装和配置](markdown-file/Zookeeper-Install.md)
+* [Daemontools 工具介绍](markdown-file/Daemontools.md)
+* [Tmux 安装和配置](markdown-file/Tmux-Install-And-Settings.md)
+* [ELK 日志收集系统安装和配置](markdown-file/ELK-Install-And-Settings.md)
+* [Dubbo 安装和配置](markdown-file/Dubbo-Install-And-Settings.md)
+* [GitLab 安装和配置](markdown-file/Gitlab-Install-And-Settings.md)
+* [JMeter 安装和配置](markdown-file/JMeter-Install-And-Settings.md)
+* [Docker 安装和使用](markdown-file/Docker-Install-And-Usage.md)
+* [Harbor 安装和配置](markdown-file/Harbor-Install-And-Usage.md)
+* [LDAP 安装和使用](markdown-file/LDAP-Install-And-Settings.md)
+* [Alfresco 安装和使用](markdown-file/Alfresco-Install-And-Usage.md)
+* [Apache Thrift 安装和使用](markdown-file/Thrift-Install-And-Usage.md)
+* [Node.js 安装和使用](markdown-file/Node-Install-And-Usage.md)
+* [CI 整套服务安装和使用](markdown-file/CI-Install-And-Usage.md)
+* [YApi 安装和配置](markdown-file/YApi-Install-And-Settings.md)
+* [Kafka 安装和配置](markdown-file/Kafka-Install-And-Settings.md)
+* [Hadoop 安装和配置](markdown-file/Hadoop-Install-And-Settings.md)
+* [Showdoc 安装和配置](markdown-file/Showdoc-Install-And-Settings.md)
+* [WordPress 安装和配置](markdown-file/WordPress-Install-And-Settings.md)
+* [GoAccess 安装和配置](markdown-file/GoAccess-Install-And-Settings.md)
+* [Portainer 安装和配置](markdown-file/Portainer-Install-And-Settings.md)
+* [Influxdb 安装和配置](markdown-file/Influxdb-Install-And-Settings.md)
+* [Prometheus 安装和配置](markdown-file/Prometheus-Install-And-Settings.md)
+* [Grafana 安装和配置](markdown-file/Grafana-Install-And-Settings.md)
+* [Ansible 安装和配置](markdown-file/Ansible-Install-And-Settings.md)
+* [Wormhole + Flink 安装和配置](markdown-file/Wormhole-Install-And-Settings.md)
+* [SkyWalking 安装和配置](markdown-file/SkyWalking-Install-And-Settings.md)
\ No newline at end of file
diff --git a/Samba.md b/Samba.md
deleted file mode 100644
index c684f630..00000000
--- a/Samba.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# Samba 介绍
-
-
-## Samba 安装
-
-- 查看是否已安装:
- - CentOS:`rpm -qa | grep samba`
- - Ubuntu:`dpkg -l | grep samba`
-
-- 安装:
- - CentOS 6:`XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
- - Ubuntu:`sudo apt-get install -y samba samba-client`
-
-## Samba 服务器配置文件常用参数
-
-- 配置文件介绍(记得先备份):`sudo vim /etc/samba/smb.conf`
- - 该配置解释:
- - 在 [globle] 区域
- - workgroup = WORKGROUP #WORKGROUP表示Windows默认的工作组名称,一般共享给windows是设置为WORKGROUP
- - security = user #ubuntu下配置文件默认没有这句,这个是自己填上去的。表示指定samba的安全等级,安全等级分别有四种:share(其他人不需要账号密码即可访问共享目录)、user(检查账号密码)、server(表示检查密码由另外一台服务器负责)、domain(指定Windows域控制服务器来验证用户的账号和密码)
- - 在新区域区域
- - 当 security = share 使用下面这段,这段自己添加的,其中myshare这个名字表示其他机子访问该分享地址时用:file://该服务机IP/myshare
- ```
- [myshare]
- comment = share all
- path = /opt/mysamba #分享的目录,其中这个目录需要chmod 777 /opt/mysamba权限
- browseable = yes
- writable = yes
- public =yes
- ```
- - 当 security = user 使用下面这段,这段自己添加的,其中 myshare2 这个名字表示其他机子访问该分享地址时用:file://该服务机IP/myshare2
- - 可以返回的账号必须是系统已经存在的账号。先给系统添加账号:`useradd user1`,再用samba的设置添加账号:`pdbedit -a user1`,会让你设立该samba账号密码。列出账号:`pdbedit -L`
- ```
- [myshare2]
- comment = share for users
- path = /opt/mysamba2 #分享的目录,其中这个目录需要chmod 777 /opt/mysamba权限
- browseable = yes
- writable = yes
- public = no
- ```
-- 启动服务:
- - `sudo service samba restart`
-
-## Samba 资料
-
--
--
--
--
diff --git a/TOC.md b/TOC.md
index c6aae5a8..434c20f7 100644
--- a/TOC.md
+++ b/TOC.md
@@ -1,47 +1,92 @@
-- [Linux 介绍](Linux.md)
-- [Ubuntu 介绍](Ubuntu.md)
-- [Ubuntu 安装](Ubuntu-Install.md)
-- [Ubuntu 设置(目录)](ubuntu-settings/ubuntu-settings-toc.md)
-- [CentOS 介绍](CentOS.md)
-- [CentOS 安装](CentOS-Install.md)
-- [CentOS 设置(目录)](centos-settings/centos-settings-toc.md)
-- [Ubuntu 安装 VMware](Ubuntu-Install-VMware.md)
-- [VMware 克隆 CentOS 后网卡信息修改](CentOS-Virtual-Machine-Copy-Settings.md)
-- [Vim 安装、配置、快捷键列表](Vim-Install-And-Settings.md)
-- [Bash 命令](Bash.md)
-- [Bash 其他常用命令](Bash-Other-Bash.md)
-- [Linux 下常用压缩文件的解压、压缩](File-Extract-Compress.md)
-- [Yum 下载安装包及对应依赖包](Off-line-Yum-Install.md)
-- [Zsh 入门](Zsh.md)
-- [nmon 系统性能监控工具](Nmon.md)
-- [SSH(Secure Shell)介绍](SSH.md)
-- [FTP(File Transfer Protocol)介绍](FTP.md)
-- [VPN(Virtual Private Network)介绍](VPN.md)
-- [NFS(Network FileSystem)介绍](NFS.md)
-- [NTP(Network Time Protocol)介绍](NTP.md)
-- [Samba 介绍](Samba.md)
-- [Crontab 介绍](Crontab.md)
-- [Iptables 介绍](Iptables.md)
-- [花生壳-安装介绍](Hsk-Install.md)
-- [JDK 安装](JDK-Install.md)
-- [SVN 安装和配置](SVN-Install-And-Settings.md)
-- [Tomcat 安装和配置、优化](Tomcat-Install-And-Settings.md)
-- [Jenkins 安装和配置](Jenkins-Install-And-Settings.md)
-- [Maven 安装和配置](Maven-Install-And-Settings.md)
-- [Nexus 安装和配置](Nexus-Install-And-Settings.md)
-- [MySQL 安装和配置](Mysql-Install-And-Settings.md)
-- [MySQL 优化](Mysql-Optimize.md)
-- [MySQL 教程](Mysql-Tutorial.md)
-- [Redis 安装和配置](Redis-Install-And-Settings.md)
-- [Solr 安装和配置](Solr-Install-And-Settings.md)
-- [Jira 安装和配置](Jira-Install-And-Settings.md)
-- [Jenkins 安装和配置](Jenkins-Install-And-Settings.md)
-- [TeamCity 安装和配置](TeamCity-Install-And-Settings.md)
-- [Nginx 安装和配置](Nginx-Install-And-Settings.md)
-- [FastDFS 安装和配置](FastDFS-Install-And-Settings.md)
-- [FastDFS 结合 GraphicsMagick](FastDFS-Nginx-Lua-GraphicsMagick.md)
-- [RabbitMQ 安装和配置](RabbitMQ-Install-And-Settings.md)
-- [Openfire 安装和配置](Openfire-Install-And-Settings.md)
-- [Rap 安装和配置](Rap-Install-And-Settings.md)
-- [Nginx + Keepalived 高可用](Nginx-Keepalived-Install-And-Settings.md)
-- [黑客入侵检查](Was-Hacked.md)
\ No newline at end of file
+- [Linux 介绍](markdown-file/Linux.md)
+- [Ubuntu 介绍](markdown-file/Ubuntu.md)
+- [Ubuntu 安装](markdown-file/Ubuntu-Install.md)
+- [Ubuntu 设置(目录)](markdown-file/ubuntu-settings/ubuntu-settings-toc.md)
+- [Kali Linux 介绍和设置(目录)](markdown-file/kali-linux-settings/kali-linux-toc.md)
+- [CentOS 介绍](markdown-file/CentOS.md)
+- [CentOS 6 安装](markdown-file/CentOS-Install.md)
+- [CentOS 7 安装](markdown-file/CentOS-7-Install.md)
+- [CentOS 6 和 CentOS 7 差异](markdown-file/CentOS6-and-CentOS7.md)
+- [CentOS 设置(目录)](markdown-file/centos-settings/centos-settings-toc.md)
+- [Ubuntu 安装 VMware](markdown-file/Ubuntu-Install-VMware.md)
+- [VMware 克隆 CentOS 后网卡信息修改](markdown-file/CentOS-Virtual-Machine-Copy-Settings.md)
+- [Vim 安装、配置、快捷键列表](markdown-file/Vim-Install-And-Settings.md)
+- [SSH 免密登录](markdown-file/SSH-login-without-password.md)
+- [Bash 命令](markdown-file/Bash.md)
+- [Bash 其他常用命令](markdown-file/Bash-Other-Bash.md)
+- [安装的 rm(删除)](markdown-file/shell-safe-rm.md)
+- [Sed 命令](markdown-file/Sed.md)
+- [Linux 下常用压缩文件的解压、压缩](markdown-file/File-Extract-Compress.md)
+- [Yum 下载安装包及对应依赖包](markdown-file/Off-line-Yum-Install.md)
+- [Zsh 入门](markdown-file/Zsh.md)
+- [终端测速](markdown-file/speedtest.md)
+- [日常维护](markdown-file/maintenance.md)
+- [日常监控](markdown-file/monitor.md)
+- [nmon 系统性能监控工具](markdown-file/Nmon.md)
+- [Glances 安装和配置](markdown-file/Glances-Install-And-Settings.md)
+- [SSH(Secure Shell)介绍](markdown-file/SSH.md)
+- [FTP(File Transfer Protocol)介绍](markdown-file/FTP.md)
+- [VPN(Virtual Private Network)介绍](markdown-file/VPN.md)
+- [NFS(Network FileSystem)介绍](markdown-file/NFS.md)
+- [NTP(Network Time Protocol)介绍](markdown-file/NTP.md)
+- [Samba 介绍](markdown-file/Samba.md)
+- [Crontab 介绍](markdown-file/Crontab.md)
+- [Iptables 介绍](markdown-file/Iptables.md)
+- [花生壳-安装介绍](markdown-file/Hsk-Install.md)
+- [JDK 安装](markdown-file/JDK-Install.md)
+- [Java bin 目录下的工具](markdown-file/Java-bin.md)
+- [SVN 安装和配置](markdown-file/SVN-Install-And-Settings.md)
+- [Tomcat 安装和配置、优化](markdown-file/Tomcat-Install-And-Settings.md)
+- [Jenkins 安装和配置](markdown-file/Jenkins-Install-And-Settings.md)
+- [Maven 安装和配置](markdown-file/Maven-Install-And-Settings.md)
+- [Nexus 安装和配置](markdown-file/Nexus-Install-And-Settings.md)
+- [PostgreSQL 安装和配置](markdown-file/PostgreSQL-Install-And-Settings.md)
+- [MySQL 安装和配置](markdown-file/Mysql-Install-And-Settings.md)
+- [MySQL 优化](markdown-file/Mysql-Optimize.md)
+- [MySQL 测试](markdown-file/Mysql-Test.md)
+- [MySQL 教程](markdown-file/Mysql-Tutorial.md)
+- [Percona XtraDB Cluster(PXC)安装和配置](markdown-file/PXC-Install-And-Settings.md)
+- [Redis 安装和配置](markdown-file/Redis-Install-And-Settings.md)
+- [MongoDB 安装和配置](markdown-file/MongoDB-Install-And-Settings.md)
+- [Solr 安装和配置](markdown-file/Solr-Install-And-Settings.md)
+- [Jira 安装和配置](markdown-file/Jira-Install-And-Settings.md)
+- [Confluence 安装和配置](markdown-file/Confluence-Install-And-Settings.md)
+- [Jenkins 安装和配置](markdown-file/Jenkins-Install-And-Settings.md)
+- [TeamCity 安装和配置](markdown-file/TeamCity-Install-And-Settings.md)
+- [Nginx 安装和配置](markdown-file/Nginx-Install-And-Settings.md)
+- [wrk 安装和配置](markdown-file/wrk-Install-And-Settings.md)
+- [FastDFS 安装和配置](markdown-file/FastDFS-Install-And-Settings.md)
+- [FastDFS 结合 GraphicsMagick](markdown-file/FastDFS-Nginx-Lua-GraphicsMagick.md)
+- [RabbitMQ 安装和配置](markdown-file/RabbitMQ-Install-And-Settings.md)
+- [Openfire 安装和配置](markdown-file/Openfire-Install-And-Settings.md)
+- [Rap 安装和配置](markdown-file/Rap-Install-And-Settings.md)
+- [Nginx + Keepalived 高可用](markdown-file/Nginx-Keepalived-Install-And-Settings.md)
+- [黑客入侵检查](markdown-file/Was-Hacked.md)
+- [Shadowsocks 安装和配置](markdown-file/http://code.youmeek.com/2016/08/19/2016/08/VPS/)
+- [Mycat 安装和配置](markdown-file/Mycat-Install-And-Settings.md)
+- [Zookeeper 安装和配置](markdown-file/Zookeeper-Install.md)
+- [Daemontools 工具介绍](markdown-file/Daemontools.md)
+- [Tmux 安装和配置](markdown-file/Tmux-Install-And-Settings.md)
+- [ELK 日志收集系统安装和配置](markdown-file/ELK-Install-And-Settings.md)
+- [Dubbo 安装和配置](markdown-file/Dubbo-Install-And-Settings.md)
+- [GitLab 安装和配置](markdown-file/Gitlab-Install-And-Settings.md)
+- [JMeter 安装和配置](markdown-file/JMeter-Install-And-Settings.md)
+- [Docker 安装和使用](markdown-file/Docker-Install-And-Usage.md)
+- [Harbor 安装和配置](markdown-file/Harbor-Install-And-Usage.md)
+- [LDAP 安装和使用](markdown-file/LDAP-Install-And-Settings.md)
+- [Alfresco 安装和使用](markdown-file/Alfresco-Install-And-Usage.md)
+- [Apache Thrift 安装和使用](markdown-file/Thrift-Install-And-Usage.md)
+- [Node.js 安装和使用](markdown-file/Node-Install-And-Usage.md)
+- [YApi 安装和配置](markdown-file/YApi-Install-And-Settings.md)
+- [Kafka 安装和配置](markdown-file/Kafka-Install-And-Settings.md)
+- [Hadoop 安装和配置](markdown-file/Hadoop-Install-And-Settings.md)
+- [Showdoc 安装和配置](markdown-file/Showdoc-Install-And-Settings.md)
+- [WordPress 安装和配置](markdown-file/WordPress-Install-And-Settings.md)
+- [GoAccess 安装和配置](markdown-file/GoAccess-Install-And-Settings.md)
+- [Portainer 安装和配置](markdown-file/Portainer-Install-And-Settings.md)
+- [Influxdb 安装和配置](markdown-file/Influxdb-Install-And-Settings.md)
+- [Prometheus 安装和配置](markdown-file/Prometheus-Install-And-Settings.md)
+- [Grafana 安装和配置](markdown-file/Grafana-Install-And-Settings.md)
+- [Ansible 安装和配置](markdown-file/Ansible-Install-And-Settings.md)
+- [Wormhole + Flink 安装和配置](markdown-file/Wormhole-Install-And-Settings.md)
+- [SkyWalking 安装和配置](markdown-file/SkyWalking-Install-And-Settings.md)
\ No newline at end of file
diff --git a/Tomcat-Install-And-Settings.md b/Tomcat-Install-And-Settings.md
deleted file mode 100644
index ac4f6c3b..00000000
--- a/Tomcat-Install-And-Settings.md
+++ /dev/null
@@ -1,182 +0,0 @@
-# Tomcat 8 安装和配置、优化
-
-
-## Tomcat 8 安装
-
-- Tomcat 8 安装
- - 官网:
- - Tomcat 8 官网下载:
- - 此时(20160207) Tomcat 8 最新版本为:`apache-tomcat-8.0.32.tar.gz`
- - 我个人习惯 `/opt` 目录下创建一个目录 `setups` 用来存放各种软件安装包;在 `/usr` 目录下创建一个 `program` 用来存放各种解压后的软件包,下面的讲解也都是基于此习惯
- - 我个人已经使用了第三方源:`EPEL、RepoForge`,如果你出现 `yum install XXXXX` 安装不成功的话,很有可能就是你没有相关源,请查看我对源设置的文章
- - Tomcat 8 下载:`wget http://apache.fayea.com/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz`
- - 压缩包解压:`tar -zxvf apache-tomcat-8.0.32.tar.gz`
- - 移到解压出来文件夹到 /usr 下:`mv apache-tomcat-8.0.32/ /usr/program/`
- - 为了方便,修改解压目录的名字:`mv /usr/program/apache-tomcat-8.0.32/ /usr/program/tomcat8/`
-- 设置 Iptables 规则(这一步是必须设置的):
- - 一种方式:先关闭 iptables,防止出现拦截问题而测试不了:`service iptables stop`
- - 一种方式:在 iptables 中添加允许规则(Tomcat 默认端口是 8080):
- - 添加规则:`sudo iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT`
- - 保存规则:`sudo /etc/rc.d/init.d/iptables save`
- - 重启 iptables:`sudo service iptables restart`
-- 测试安装好后的 Tomcat:
- - 启动 Tomcat:`sh /usr/program/tomcat8/bin/startup.sh ; tail -200f /usr/program/tomcat8/logs/catalina.out`
- - 访问:`http://服务器 IP 地址:8080/`
- - 停止 Tomcat:`sh /usr/program/tomcat8/bin/shutdown.sh`
-
-
-## Tomcat 8 配置
-
-- 设置 Tomcat 相关变量:
- - `sudo vim /usr/program/tomcat8/bin/catalina.sh`
- - 在配置文件的可编辑内容最上面(98 行开始),加上如下内容(具体参数根据你服务器情况自行修改):
- ``` ini
- JAVA_HOME=/usr/program/jdk1.8.0_72
- CATALINA_HOME=/usr/program/tomcat8
- CATALINA_OPTS="-server -Xms528m -Xmx528m -XX:PermSize=256m -XX:MaxPermSize=358m"
- CATALINA_PID=$CATALINA_HOME/catalina.pid
- ```
-- 如果使用 `shutdown.sh` 还无法停止 tomcat,可以修改其配置:`vim /usr/program/tomcat8/bin/shutdown.sh`
- - 把最尾巴这一行:`exec "$PRGDIR"/"$EXECUTABLE" stop "$@"`
- - 改为:`exec "$PRGDIR"/"$EXECUTABLE" stop 10 -force`
-
-
-## Tomcat 8 优化
-
-- Tomcat 6/7/8 的优化参数有点不一样,最好按下面的方式看一下官网这个文档是否还保留着这个参数
-- 启动tomcat,访问该地址,下面要讲解的一些配置信息,在该文档下都有说明的:
- - 文档:
- - 你也可以直接看网络版本:
- - Tomcat 6 文档:
- - Tomcat 7 文档:
- - Tomcat 8 文档:
-- 如果你需要查看 Tomcat 的运行状态可以配置tomcat管理员账户,然后登陆 Tomcat 后台进行查看
-- 编辑 /opt/tomcat7/bin/conf/tomcat-users.xml 文件,在里面添加下面信息:
-``` xml
-
-
-
-
-
-```
-- 编辑配置文件:`vim /usr/program/tomcat7/conf/server.xml`
- - 打开默认被注释的连接池配置:
- - 默认值:
- ``` xml
-
- ```
- - 修改为:
- ``` xml
-
- ```
- - 重点参数解释:
- - maxThreads,最大并发数,默认设置 200,一般建议在 500 ~ 800,根据硬件设施和业务来判断
- - minSpareThreads,Tomcat 初始化时创建的线程数,默认设置 25
- - prestartminSpareThreads,在 Tomcat 初始化的时候就初始化 minSpareThreads 的参数值,如果不等于 true,minSpareThreads 的值就没啥效果了
- - maxQueueSize,最大的等待队列数,超过则拒绝请求
- - 修改默认的链接参数配置:
- - 默认值:
- ``` xml
-
- ```
- - 修改为:
- ``` xml
-
- ```
- - 重点参数解释:
- - protocol,Tomcat 8 设置 nio2 更好:org.apache.coyote.http11.Http11Nio2Protocol(如果这个用不了,就用下面那个)
- - protocol,Tomcat 6、7 设置 nio 更好:org.apache.coyote.http11.Http11NioProtocol
- - enableLookups,禁用DNS查询
- - acceptCount,指定当所有可以使用的处理请求的线程数都被使用时,可以放到处理队列中的请求数,超过这个数的请求将不予处理,默认设置 100
- - maxPostSize,以 FORM URL 参数方式的 POST 提交方式,限制提交最大的大小,默认是 2097152(2兆),它使用的单位是字节。10485760 为 10M。如果要禁用限制,则可以设置为 -1。
- - acceptorThreadCount,用于接收连接的线程的数量,默认值是1。一般这个指需要改动的时候是因为该服务器是一个多核CPU,如果是多核 CPU 一般配置为 2.
- - 禁用 AJP(如果你服务器没有使用 Apache)
- - 把下面这一行注释掉,默认 Tomcat 是开启的。
- ``` xml
-
- ```
-
-
-
-## JVM 优化
-
-- 模型资料来源:
-- Java 的内存模型分为:
- - Young,年轻代(易被 GC)。Young 区被划分为三部分,Eden 区和两个大小严格相同的 Survivor 区,其中 Survivor 区间中,某一时刻只有其中一个是被使用的,另外一个留做垃圾收集时复制对象用,在 Young 区间变满的时候,minor GC 就会将存活的对象移到空闲的Survivor 区间中,根据 JVM 的策略,在经过几次垃圾收集后,任然存活于 Survivor 的对象将被移动到 Tenured 区间。
- - Tenured,终身代。Tenured 区主要保存生命周期长的对象,一般是一些老的对象,当一些对象在 Young 复制转移一定的次数以后,对象就会被转移到 Tenured 区,一般如果系统中用了 application 级别的缓存,缓存中的对象往往会被转移到这一区间。
- - Perm,永久代。主要保存 class,method,filed 对象,这部门的空间一般不会溢出,除非一次性加载了很多的类,不过在涉及到热部署的应用服务器的时候,有时候会遇到 java.lang.OutOfMemoryError : PermGen space 的错误,造成这个错误的很大原因就有可能是每次都重新部署,但是重新部署后,类的 class 没有被卸载掉,这样就造成了大量的 class 对象保存在了 perm 中,这种情况下,一般重新启动应用服务器可以解决问题。
-- Linux 修改 /usr/program/tomcat7/bin/catalina.sh 文件,把下面信息添加到文件第一行。Windows 和 Linux 有点不一样的地方在于,在 Linux 下,下面的的参数值是被引号包围的,而 Windows 不需要引号包围。
- - 如果服务器只运行一个 Tomcat
- - 机子内存如果是 8G,一般 PermSize 配置是主要保证系统能稳定起来就行:
- - `JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms6144m -Xmx6144m -XX:NewSize=1024m -XX:MaxNewSize=2048m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:MaxTenuringThreshold=10 -XX:NewRatio=2 -XX:+DisableExplicitGC"`
- - 机子内存如果是 16G,一般 PermSize 配置是主要保证系统能稳定起来就行:
- - `JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms13312m -Xmx13312m -XX:NewSize=3072m -XX:MaxNewSize=4096m -XX:PermSize=512m -XX:MaxPermSize=512m -XX:MaxTenuringThreshold=10 -XX:NewRatio=2 -XX:+DisableExplicitGC"`
- - 机子内存如果是 32G,一般 PermSize 配置是主要保证系统能稳定起来就行:
- - `JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms29696m -Xmx29696m -XX:NewSize=6144m -XX:MaxNewSize=9216m -XX:PermSize=1024m -XX:MaxPermSize=1024m -XX:MaxTenuringThreshold=10 -XX:NewRatio=2 -XX:+DisableExplicitGC"`
- - 如果是开发机
- - `-Xms550m -Xmx1250m -XX:PermSize=550m -XX:MaxPermSize=1250m`
- - 参数说明:
- ``` nginx
- -Dfile.encoding:默认文件编码
- -server:表示这是应用于服务器的配置,JVM 内部会有特殊处理的
- -Xmx1024m:设置JVM最大可用内存为1024MB
- -Xms1024m:设置JVM最小内存为1024m。此值可以设置与-Xmx相同,以避免每次垃圾回收完成后JVM重新分配内存。
- -XX:NewSize:设置年轻代大小
- -XX:MaxNewSize:设置最大的年轻代大小
- -XX:PermSize:设置永久代大小
- -XX:MaxPermSize:设置最大永久代大小
- -XX:NewRatio=4:设置年轻代(包括 Eden 和两个 Survivor 区)与终身代的比值(除去永久代)。设置为 4,则年轻代与终身代所占比值为 1:4,年轻代占整个堆栈的 1/5
- -XX:MaxTenuringThreshold=10:设置垃圾最大年龄,默认为:15。如果设置为 0 的话,则年轻代对象不经过 Survivor 区,直接进入年老代。对于年老代比较多的应用,可以提高效率。如果将此值设置为一个较大值,则年轻代对象会在 Survivor 区进行多次复制,这样可以增加对象再年轻代的存活时间,增加在年轻代即被回收的概论。
- -XX:+DisableExplicitGC:这个将会忽略手动调用 GC 的代码使得 System.gc() 的调用就会变成一个空调用,完全不会触发任何 GC
- ```
-
-
-## 其他
-
-- Tomcat 历史版本下载地址整理(不间断更新):
- - **Tomcat 9.0.0.M4**:`wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M4/bin/apache-tomcat-9.0.0.M4.tar.gz`
- - **Tomcat 8.0.32**:`wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz`
- - **Tomcat 7.0.68**:`wget http://apache.fayea.com/tomcat/tomcat-7/v7.0.68/bin/apache-tomcat-7.0.68.tar.gz`
- - **Tomcat 6.0.45**:`wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-6/v6.0.45/bin/apache-tomcat-6.0.45.tar.gz`
-
-## 资料
-
--
--
--
--
--
--
--
--
diff --git a/VPN.md b/VPN.md
deleted file mode 100644
index 29253e5a..00000000
--- a/VPN.md
+++ /dev/null
@@ -1,118 +0,0 @@
-VPN(Virtual Private Network)介绍
-
-------
-
-* [VPN(Virtual Private Network)介绍](#vpn0)
- * [VPN 介绍](#vpn1)
- * [PPTPD 安装](#vpn2)
- * [PPTPD 服务配置](#vpn3)
- * [L2TPD 安装](#vpn4)
- * [L2TPD 服务配置](#vpn5)
- * [VPN 资料](#vpn6)
-
-------
-
-VPN 介绍
-
-VPN 分类有很多,这里主要讲 PPTPD 和 L2TPD
-
-PPTPD 安装
-
-- 查看是否已安装:
- - CentOS:`rpm -qa | grep pptpd`
- - Ubuntu:`dpkg -l | grep pptpd`
-
-- 安装:
- - CentOS 6:`XXXXXXXXXXXXXXXXXXXXXXXX`
- - Ubuntu:`sudo apt-get install -y ppp pptpd`
-
-PPTPD 服务配置
-
-- 注意:PPTPD 默认端口是 1723,所以防火墙要取消对其限制,查看 1723 端口是否开启:`sudo netstat -apnl | grep 1723`
-- 编辑 PPTPD 配置文件介绍(记得先备份):`sudo vim /etc/pptpd.conf`
- - 修改配置信息:
- - option /etc/ppp/pptpd-options #配置文件中有一行这样的参数,如果没有自己添加上去。
- - logwtmp #默认这个是没有被注释的,这里要进行注释
- - localip 172.31.0.1 #本机服务器的内网IP地址,建议你的内网IP一般不要用常见网段,默认这个被注释,取消注释
- - remoteip 192.168.0.10-200 #客户端的IP地址范围,默认这个被注释,取消注释
-- 编辑 PPP 配置文件介绍(记得先备份):`sudo vim /etc/ppp/pptpd-options`
- - 在文件尾巴添加如下配置信息:
- - ms-dns 8.8.8.8 #配置DNS,如果是境外服务器最好改为google的,国内的看情况
- - ms-dns 8.8.4.4 #配置DNS,如果是境外服务器最好改为google的,国内的看情况
-- 开启系统转发(记得先备份):`sudo vim /etc/sysctl.conf`
- - 修改配置信息:
- - net.ipv4.ip_forward=1 #默认是注释掉的,要取消注释
- - 刷新配置:`sudo sysctl -p`
-- 设置 iptables 转发:
- - 追加 iptables 规则:`sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE`
- - 设置默认启动使用该规则:`sudo vim /etc/rc.local`
- - 在配置文件中添加:iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
-- 添加登录账号(记得先备份):`sudo vim /etc/ppp/chap-secrets`
- - 在文件尾巴添加如下配置信息:
- - mytest1 pptpd 123456 * #该格式分别表示:登录名、登录协议、密码、该连接上的客户端用什么 IP(* 表示随机一个 IP)
-- 重启服务:`sudo service pptpd restart`
-
-L2TPD 安装
-
-- 查看是否已安装:
- - CentOS:`rpm -qa | grep xl2tpd`
- - Ubuntu:`dpkg -l | grep xl2tpd`
-
-- 安装:
- - CentOS 6:`XXXXXXXXXXXXXXXXXXXXXXXX`
- - Ubuntu:`sudo apt-get install -y xl2tpd ppp openswan`
-
-L2TPD 服务配置
-
-- 注意:L2TPD 默认端口是 1701,所以防火墙要取消对其限制,查看 1701 端口是否开启:`sudo netstat -apnl | grep 1701`
-- 编辑 Openswan 配置文件介绍(记得先备份):`sudo vim /etc/ipsec.conf`
- - left=172.31.201.255 #其中这里的IP地址改为本机的内网IP,文件中有两处,都进行修改
-- 编辑 IPsec-based 配置文件介绍(记得先备份):`sudo vim /etc/ipsec.secrets`
- - 172.31.201.255 %any: PSK"adc123456" #在文件最后一行补充:(格式是:本机内网IP,后面是配置密钥。密钥不配置也可以但是建议配上去)
-- 编辑 L2TPD 配置文件介绍(记得先备份):`sudo vim /etc/xl2tpd/xl2tpd.conf`
- - 修改配置信息:
- - ipsec saref = yes
- - require chap = yes
- - refuse pap = yes
- - require authentication = yes
- - ppp debug = yes
- - length bit = yes
- - ip range = 192.168.1.10-192.168.1.200 #这是客户端连接本机的IP端限制
- - local ip = 172.31.201.255 #这是本机服务器端的内网 IP
- - pppoptfile = /etc/ppp/options.xl2tpd #指定本机的 PPP 配置文件地址,如果你的 PPP 配置文件地址不是这里那就改下
-- 编辑 PPP 配置文件介绍(记得先备份):`sudo vim /etc/ppp/options.xl2tpd` (如果没有这个文件自己创建)
- - 在文件尾巴添加如下配置信息:
- - refuse-mschap-v2
- - refuse-mschap
- - ms-dns 8.8.8.8 #配置DNS,如果是境外服务器最好改为google的,国内的看情况
- - ms-dns 8.8.4.4 #配置DNS,如果是境外服务器最好改为google的,国内的看情况
- - asyncmap 0
- - auth
- - lock
- - hide-password
- - local
- - name l2tpd
- - proxyarp
- - lcp-echo-interval 30
- - lcp-echo-failure 4
- - refuse
- - refuse
- - refuse
-- 在终端输入命令:sudo sh -c 'for each in /proc/sys/net/ipv4/conf/* do echo 0 > $each/accept_redirects echo 0 > $each/send_redirects done'
-- 开启系统转发(记得先备份):`sudo vim /etc/sysctl.conf`
- - 修改配置信息:
- - net.ipv4.ip_forward=1 #默认是注释掉的,要取消注释
- - 刷新配置:`sudo sysctl -p`
-- 设置 iptables 转发:
- - 追加 iptables 规则:`sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE`
- - 设置默认启动使用该规则:`sudo vim /etc/rc.local`
- - 在配置文件中添加:iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
-- 添加登录账号(记得先备份):`sudo vim /etc/ppp/chap-secrets`
- - 在文件尾巴添加如下配置信息:
- - mytest1 l2tpd 123456 * #该格式分别表示:登录名、登录协议、密码、该连接上的客户端用什么 IP(* 表示随机一个 IP)
-- 重启服务:`sudo service l2tpd restart`
-
-VPN 资料
-
--
-- [Freeradius 服务(用于账号认证管理的工具,可以扩展到VPN的账号管理)](http://www.jikexueyuan.com/course/1692_4.html?ss=2)
diff --git a/centos-settings/CentOS-Extra-Packages.md b/centos-settings/CentOS-Extra-Packages.md
index fa42ccac..c00901e3 100644
--- a/centos-settings/CentOS-Extra-Packages.md
+++ b/centos-settings/CentOS-Extra-Packages.md
@@ -1,10 +1,10 @@
# CentOS 源设置
-修改官方源
+## 修改官方源
- 下面内容的一个简易集合版本脚本:
-修改官方源
+## 修改官方源
> 国内常用源配置方法(该源和官方源是一样的,只是因为服务器在国内会起到加速作用而已):
@@ -12,22 +12,33 @@
- 阿里源:
- sohu:
-> 替换过程(这里以 163 源为例,系统 CentOS 6.7):
+> CentOS 6 替换过程(这里以 163 源为例):
- 备份官网源:`sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.20151219.backup`
- `cd /etc/yum.repos.d/`
- 下载对应版本 repo 文件, 放入 **/etc/yum.repos.d/**
- 下载源文件:
- - CentOS7:`sudo wget http://mirrors.163.com/.help/CentOS7-Base-163.repo`
- CentOS6:`sudo wget http://mirrors.163.com/.help/CentOS6-Base-163.repo`
- - CentOS5:`sudo wget http://mirrors.163.com/.help/CentOS5-Base-163.repo`
- `sudo mv CentOS6-Base-163.repo CentOS-Base.repo`
- 导入key:`rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6`
- `sudo yum clean all`
- `sudo yum makecache`
- `sudo yum update -y`
-第三方源
+> CentOS 7 替换过程(这里以 163 源为例):
+
+- 备份官网源:`sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.20170219.backup`
+- `cd /etc/yum.repos.d/`
+- 下载对应版本 repo 文件, 放入 **/etc/yum.repos.d/**
+ - 下载源文件:
+ - CentOS7:`sudo wget http://mirrors.163.com/.help/CentOS7-Base-163.repo`
+ - `sudo mv CentOS7-Base-163.repo CentOS-Base.repo`
+ - 导入key:`rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7`
+ - `sudo yum clean all`
+ - `sudo yum makecache`
+ - `sudo yum update -y`
+
+## 第三方源
> 加入第三方源主要是为了 yum 下载到官方没有提供的软件,在其他社区、第三方源里面有很多的软件包,有些软件是很好用的。CentOS 可以加入多个源,所以就存在一个源的优先级问题了,设置优先级的可以使用 yum-plugin-priorities 工具。一般我是建议官方的优先级是最高的,然后才是第三方的。
@@ -46,7 +57,8 @@
- 安装 EPEL 源:
- 官网中文材料:
- 安装命令:`sudo yum install -y epel-release`
- - 导入 KEY:`rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6`
+ - CentOS 6 导入 KEY:`rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6`
+ - CentOS 7 导入 KEY:`rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7`
- 设置 EPEL 源的级别:`vim /etc/yum.repos.d/epel.repo`,追加:priority=11
- 卸载 EPEL 源
- 如果你暂时不想使用 EPEL 源的话,把 epel.repo 里的 enabled=1 改成 enabled=0 即可,如果你完全不需要了,那就直接卸载掉 `sudo rpm -e epel-release`
@@ -71,6 +83,22 @@
- `sudo yum install -y htop`(htop 官方源是没有的,所以如果能下载下来就表示已经使用了第三方源)
+### 禁用源
+
+- 编辑:`vim /etc/yum.repos.d/elasticsearch.repo`
+- 把 enabled=1 改为 enabled=0
+
+```
+[elasticsearch-6.x]
+name=Elasticsearch repository for 6.x packages
+baseurl=https://artifacts.elastic.co/packages/6.x/yum
+gpgcheck=1
+gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
+enabled=1
+autorefresh=1
+type=rpm-md
+```
+
> 资料:
-
diff --git a/centos-settings/CentOS-Network-Settings.md b/centos-settings/CentOS-Network-Settings.md
index 8936fb0f..ba95ede9 100644
--- a/centos-settings/CentOS-Network-Settings.md
+++ b/centos-settings/CentOS-Network-Settings.md
@@ -1,17 +1,11 @@
-CentOS 网络设置
+# CentOS 网络设置
-------
-
-* [CentOS 安装](#networkSettings0)
- * [界面化下设置网络](#networkSettings1)
- * [命令行下设置网络](#networkSettings2)
-
-------
- 由于前面虚拟机中安装 CentOS 使用的是桥接模式,为了让虚拟机中的系统能上网,我们需要进行网络设置。
+## CentOS 6
-界面化下设置网络(新手推荐使用这种)
+### 界面化下设置网络(新手推荐使用这种)
- 
- 选择上图箭头所示
@@ -21,7 +15,7 @@
- 如上图标注 5 所示:填写你当前地区合适的 DNS 地址,我这边地区使用 360 测试出来的结果显示 114 的适合我,所以我这里填写该值
-命令行下设置网络
+### 命令行下设置网络
- 编辑网卡信息:
- 备份:`cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0-20160205Back`
@@ -49,3 +43,40 @@
LAST_CONNECT=1454626679 (使用图形界面设置后生成的)
```
- 重启网络配置:`service network restart`
+
+## CentOS 7.x
+
+### 命令行下设置网络
+
+- 查看系统下有哪些网卡:`ls /etc/sysconfig/network-scripts/`,新版本不叫 eth0 这类格式了,比如我当前这个叫做:ifcfg-ens33(你的肯定跟我不一样,但是格式类似)
+- 先备份:`cp /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-ens33.bak`
+- 编辑该文件:`vim /etc/sysconfig/network-scripts/ifcfg-ens33`,改为如下信息:(IP 段自己改为自己的网络情况)
+
+``` ini
+TYPE=Ethernet
+PROXY_METHOD=none
+BROWSER_ONLY=no
+BOOTPROTO=static
+IPADDR=192.168.0.127
+NETMASK=255.255.255.0
+GATEWAY=192.168.0.1
+DNS1=8.8.8.8
+DNS1=114.114.114.114
+DEFROUTE=yes
+PEERDNS=yes
+PEERROUTES=yes
+IPV4_FAILURE_FATAL=no
+IPV6INIT=yes
+IPV6_AUTOCONF=yes
+IPV6_DEFROUTE=yes
+IPV6_PEERDNS=yes
+IPV6_PEERROUTES=yes
+IPV6_FAILURE_FATAL=no
+IPV6_ADDR_GEN_MODE=stable-privacy
+NAME=ens33
+UUID=b9f01b7d-4ebf-4d3a-a4ec-ae203425bb11
+DEVICE=ens33
+ONBOOT=yes
+```
+
+- 修改后,重启网络服务:`systemctl restart network.service`
\ No newline at end of file
diff --git a/centos-settings/Close-XWindow.md b/centos-settings/Close-XWindow.md
index 670efa86..5b89f556 100644
--- a/centos-settings/Close-XWindow.md
+++ b/centos-settings/Close-XWindow.md
@@ -6,10 +6,30 @@
- 本地开多个虚拟机搞集群测试,为了节省资源,关掉图形界面更好点
-## 设置方法
+## CentOS 6 设置方法
- 编辑配置文件:`vim /etc/inittab`
- 把默认值:`id:5:initdefault:`,改为:`id:3:initdefault:`
- 重启系统:`reboot`,重启后就只有 shell 界面了。
- 在 shell 界面中如果你还希望临时开启图形界面可以输入:`init 5`
- 在图形界面中如果你希望临时关闭图形界面可以输入:`init 3`
+
+
+## CentOS 7 设置方法 1
+
+- 开机以命令模式启动,执行:
+ - systemctl set-default multi-user.target
+- 开机以图形界面启动,执行:
+ - systemctl set-default graphical.target
+
+## CentOS 7 设置方法 2
+
+- 关闭图形
+ - `mv /etc/systemd/system/default.target /etc/systemd/system/default.target.bak` (改名备份)
+ - `ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target` (重新软连接文本界面为启动默认值界面)
+ - `systemctl reboot` (重启)
+
+- 恢复图形界面
+ - `rm -rf /etc/systemd/system/default.target` (移除当前配置链接)
+ - `mv /etc/systemd/system/default.target.bak /etc/systemd/system/default.target` (恢复备份配置链接)
+ - `systemctl reboot`
\ No newline at end of file
diff --git a/centos-settings/Cpu-Info.md b/centos-settings/Cpu-Info.md
deleted file mode 100644
index fb653ca6..00000000
--- a/centos-settings/Cpu-Info.md
+++ /dev/null
@@ -1,22 +0,0 @@
-## CPU 信息分析
-
-
-## 初衷
-
-- 了解服务器的性能,以方便我们如何更好地对程序进行部署
-
-
-## CPU 信息
-
-- Demo CPU 型号:[Intel® Xeon® Processor E5-2620 v2(15M Cache, 2.10 GHz)](http://ark.intel.com/products/75789/Intel-Xeon-Processor-E5-2620-v2-15M-Cache-2_10-GHz)
-- 该 CPU 显示的数据中有一项这个要注意:`Intel® Hyper-Threading Technology` 是 `Yes`。表示该 CPU 支持超线程
-- `cat /proc/cpuinfo`,查看 CPU 总体信息
-- `grep 'physical id' /proc/cpuinfo | sort -u | wc -l`,查看物理 CPU 个数
- - 结果:2
- - 物理 CPU:物理 CPU 也就是机器外面就能看到的一个个 CPU,每个物理 CPU 还带有单独的风扇
-- `grep 'core id' /proc/cpuinfo | sort -u | wc -l`,查看每个物理 CPU 的核心数量
- - 结果:6,因为每个物理 CPU 是 6,所有 2 个物理 CPU 的总核心数量应该是:12
- - 核心数:一个核心就是一个物理线程,英特尔有个超线程技术可以把一个物理线程模拟出两个线程来用,充分发挥 CPU 性能,意思是一个核心可以有多个线程。
-- `grep 'processor' /proc/cpuinfo | sort -u | wc -l`,查看 CPU 总的线程数,一般也叫做:逻辑 CPU 数量
- - 结果:24,正常情况下:CPU 的总核心数量 == CPU 线程数,但是如果该 CPU 支持超线程,那结果是:CPU 的总核心数量 X 2 == CPU 线程数
- - 线程数:线程数是一种逻辑的概念,简单地说,就是模拟出的 CPU 核心数。比如,可以通过一个 CPU 核心数模拟出 2 线程的 CPU,也就是说,这个单核心的 CPU 被模拟成了一个类似双核心 CPU 的功能。
diff --git a/centos-settings/centos-settings-toc.md b/centos-settings/centos-settings-toc.md
index 4c05b3d8..4f73b884 100644
--- a/centos-settings/centos-settings-toc.md
+++ b/centos-settings/centos-settings-toc.md
@@ -1,7 +1,6 @@
- [CentOS 网络设置](CentOS-Network-Settings.md)
- [CentOS 源设置](CentOS-Extra-Packages.md)
- [CentOS 图形界面的关闭与开启](Close-XWindow.md)
-- [CPU 信息分析](Cpu-Info.md)
- [清除系统缓存](Clear-Cache.md)
- [修改定时清理 /tmp 目录下的文件](Clear-Tmp-Directory.md)
diff --git a/Keepalived-Settings/nginx_check.sh b/favorite-file/Keepalived-Settings/nginx_check.sh
similarity index 100%
rename from Keepalived-Settings/nginx_check.sh
rename to favorite-file/Keepalived-Settings/nginx_check.sh
diff --git a/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-comprehensive.cnf b/favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-comprehensive.cnf
similarity index 97%
rename from MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-comprehensive.cnf
rename to favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-comprehensive.cnf
index ad992020..0caf21ee 100644
--- a/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-comprehensive.cnf
+++ b/favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-comprehensive.cnf
@@ -32,7 +32,7 @@ default-storage-engine = InnoDB
socket = /usr/program/mysql/data/mysql.sock
pid-file = /usr/program/mysql/data/mysql.pid
-collation-server = utf8_unicode_ci
+collation-server = utf8_general_ci
init_connect = 'SET NAMES utf8'
character-set-server = utf8
basedir = /usr/program/mysql
@@ -52,7 +52,7 @@ back_log = 512
max_connections = 1000
# 网络传输中一次小心传输量的最大值(最大值为 1G);增加该变量的值十分安全,这是因为仅当需要时才会分配额外内存。例如,仅当你发出长查询或 MySQL 必须返回大的结果行时 MySQL 才会分配更多内存。该变量之所以取较小默认值是一种预防措施,以捕获客户端和服务器之间的错误信息包,并确保不会因偶然使用大的信息包而导致内存溢出。
max_allowed_packet = 16M
-# 对于同一主机,如果有超出该参数值个数的中断错误连接,则该主机将被禁止连接。如需对该主机进行解禁,执行 Mysql 命令:FLUSH HOST。
+# (这个参数有疑问)对于同一主机,如果有超出该参数值个数的中断错误连接,则该主机将被禁止连接。如需对该主机进行解禁,执行 Mysql 命令:FLUSH HOST。
max_connect_errors = 1000000
# 禁止MySQL对外部连接进行DNS解析,使用这一选项可以消除MySQL进行DNS解析的时间。但需要注意,如果开启该选项,则所有远程主机连接授权都要使用IP地址方式,否则MySQL将无法正常处理连接请求
skip-name-resolve
diff --git a/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-master.cnf b/favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-master.cnf
similarity index 99%
rename from MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-master.cnf
rename to favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-master.cnf
index 026deaa0..d07463f6 100644
--- a/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-master.cnf
+++ b/favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-master.cnf
@@ -29,7 +29,7 @@ default-storage-engine = InnoDB
socket = /usr/program/mysql/data/mysql.sock
pid-file = /usr/program/mysql/data/mysql.pid
-collation-server = utf8_unicode_ci
+collation-server = utf8_general_ci
init_connect = 'SET NAMES utf8'
character-set-server = utf8
basedir = /usr/program/mysql
diff --git a/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-salve.cnf b/favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-salve.cnf
similarity index 99%
rename from MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-salve.cnf
rename to favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-salve.cnf
index d8462fb8..825cc89d 100644
--- a/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-salve.cnf
+++ b/favorite-file/MySQL-Settings/MySQL-5.6/1G-Memory-Machine/my-for-salve.cnf
@@ -29,7 +29,7 @@ default-storage-engine = InnoDB
socket = /usr/program/mysql/data/mysql.sock
pid-file = /usr/program/mysql/data/mysql.pid
-collation-server = utf8_unicode_ci
+collation-server = utf8_general_ci
init_connect = 'SET NAMES utf8'
character-set-server = utf8
basedir = /usr/program/mysql
diff --git a/favorite-file/MySQL-Settings/MySQL-5.6/8G-Memory-Machine/my.cnf b/favorite-file/MySQL-Settings/MySQL-5.6/8G-Memory-Machine/my.cnf
new file mode 100644
index 00000000..f6da9bb2
--- /dev/null
+++ b/favorite-file/MySQL-Settings/MySQL-5.6/8G-Memory-Machine/my.cnf
@@ -0,0 +1,92 @@
+[mysql]
+port = 3306
+socket = /usr/program/mysql/data/mysql.sock
+default-character-set = utf8
+
+[mysqld]
+user = mysql
+port = 3306
+server-id = 100866
+default-storage-engine = InnoDB
+socket = /usr/program/mysql/data/mysql.sock
+pid-file = /usr/program/mysql/data/mysql.pid
+collation-server = utf8_general_ci
+init_connect = 'SET NAMES utf8'
+character-set-server = utf8
+basedir = /usr/program/mysql
+datadir = /usr/program/mysql/data
+log-error = /usr/program/mysql/data/mysql-error.log
+
+back_log = 512
+max_connections = 1000
+max_allowed_packet = 120M
+max_connect_errors = 1000000
+skip-name-resolve
+open_files_limit = 65535
+table_open_cache = 2048
+binlog_cache_size = 20M
+max_heap_table_size = 40M
+tmp_table_size = 64M
+read_buffer_size = 20M
+read_rnd_buffer_size = 20M
+sort_buffer_size = 20M
+join_buffer_size = 20M
+key_buffer_size = 40M
+thread_cache_size = 100
+thread_stack = 20M
+
+# 5.6.8之后这个不再建议开启了,所以要关掉
+query_cache_type = 0
+query_cache_size = 40M
+query_cache_limit = 10M
+ft_min_word_len = 4
+log-bin = /usr/program/mysql/data/mysql-bin
+binlog-format = mixed
+expire_logs_days = 14
+sync_binlog = 0
+log-queries-not-using-indexes = 1
+slow_query_log = 0
+long_query_time = 3
+slow_query_log_file = /usr/program/mysql/data/mysql-slow.log
+performance_schema = 0
+explicit_defaults_for_timestamp = true
+lower_case_table_names = 1
+skip_external_locking
+table_definition_cache = 1024
+thread_concurrency = 2
+innodb = FORCE
+innodb_flush_method = O_DIRECT
+innodb_file_per_table = 1
+innodb_open_files = 500
+innodb_thread_concurrency = 0
+innodb_purge_threads = 1
+innodb_flush_log_at_trx_commit = 1
+innodb_log_buffer_size = 20M
+innodb_log_file_size = 256M
+innodb_log_files_in_group = 2
+innodb_lock_wait_timeout = 120
+innodb_additional_mem_pool_size = 20M
+
+
+innodb_buffer_pool_size = 3G
+innodb_read_io_threads = 8
+innodb_write_io_threads = 8
+innodb_io_capacity = 2000
+innodb_max_dirty_pages_pct = 90
+
+bulk_insert_buffer_size = 64M
+myisam_sort_buffer_size = 64M
+myisam_max_sort_file_size = 10G
+myisam_repair_threads = 1
+interactive_timeout = 28800
+wait_timeout = 3600
+
+[mysqldump]
+quick
+max_allowed_packet = 120M
+
+[myisamchk]
+key_buffer_size = 20M
+sort_buffer_size = 20M
+read_buffer = 20M
+write_buffer = 20M
diff --git "a/MySQL-Settings/MySQL-5.6/developer/my-Windows-8G-\345\274\200\345\217\221\346\234\272.ini" "b/favorite-file/MySQL-Settings/MySQL-5.6/developer/my-Windows-8G-\345\274\200\345\217\221\346\234\272.ini"
similarity index 100%
rename from "MySQL-Settings/MySQL-5.6/developer/my-Windows-8G-\345\274\200\345\217\221\346\234\272.ini"
rename to "favorite-file/MySQL-Settings/MySQL-5.6/developer/my-Windows-8G-\345\274\200\345\217\221\346\234\272.ini"
diff --git a/favorite-file/Nginx-Settings/nginx b/favorite-file/Nginx-Settings/nginx
new file mode 100644
index 00000000..11e3a346
--- /dev/null
+++ b/favorite-file/Nginx-Settings/nginx
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+
+#nginx执行程序路径需要修改
+nginxd=/usr/local/nginx/sbin/nginx
+
+# nginx配置文件路径需要修改
+nginx_config=/usr/local/nginx/conf/nginx.conf
+
+# pid 地址需要修改
+nginx_pid=/var/local/nginx/nginx.pid
+
+
+RETVAL=0
+prog="nginx"
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+# Source networking configuration.
+. /etc/sysconfig/network
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 0
+[ -x $nginxd ] || exit 0
+
+# Start nginx daemons functions.
+start() {
+if [ -e $nginx_pid ];then
+ echo "nginx already running...."
+ exit 1
+fi
+
+echo -n $"Starting $prog: "
+daemon $nginxd -c ${nginx_config}
+RETVAL=$?
+echo
+[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
+return $RETVAL
+}
+
+# Stop nginx daemons functions.
+# pid 地址需要修改
+stop() {
+ echo -n $"Stopping $prog: "
+ killproc $nginxd
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/local/nginx/nginx.pid
+}
+
+# reload nginx service functions.
+reload() {
+ echo -n $"Reloading $prog: "
+ #kill -HUP `cat ${nginx_pid}`
+ killproc $nginxd -HUP
+ RETVAL=$?
+ echo
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ reload)
+ reload
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ status)
+ status $prog
+ RETVAL=$?
+ ;;
+ *)
+
+ echo $"Usage: $prog {start|stop|restart|reload|status|help}"
+ exit 1
+
+esac
+exit $RETVAL
\ No newline at end of file
diff --git a/favorite-file/Nginx-Settings/nginx-front.conf b/favorite-file/Nginx-Settings/nginx-front.conf
new file mode 100644
index 00000000..8b49d8f9
--- /dev/null
+++ b/favorite-file/Nginx-Settings/nginx-front.conf
@@ -0,0 +1,116 @@
+user root;
+worker_processes auto;
+pid /run/nginx.pid;
+
+events {
+ use epoll;
+ multi_accept on;
+ worker_connections 1024;
+}
+
+http {
+ # 必须加这两个,不然 CSS 无法正常加载
+ include mime.types;
+ default_type application/octet-stream;
+
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+ keepalive_timeout 65;
+ types_hash_max_size 2048;
+
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
+
+ access_log /var/log/nginx/access.log main;
+ error_log /var/log/nginx/error.log;
+
+ gzip on;
+ gzip_buffers 8 16k;
+ gzip_min_length 512;
+ gzip_disable "MSIE [1-6]\.(?!.*SV1)";
+ gzip_http_version 1.1;
+ gzip_types text/plain text/css application/javascript application/x-javascript application/json application/xml;
+
+ server {
+
+ listen 8001;
+ server_name localhost 127.0.0.1 139.159.190.24 platform.gitnavi.com;
+
+ location / {
+ root /root/.jenkins/workspace/nestle-platform-front-test/dist;
+ index index.html index.htm;
+ try_files $uri /index.html;
+ }
+
+ ## 二级目录方式,记得 package.json 添加:"homepage": "cdk8s-markdown",
+ location ^~ /cdk8s-markdown {
+ root /root/.jenkins/workspace;
+ index index.html;
+ try_files $uri /cdk8s-markdown/index.html;
+ }
+
+ location ^~ /platform/ {
+ proxy_pass http://127.0.0.1:28081;
+ proxy_redirect off;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ }
+
+ location ~ .*\.(js|css)?$ {
+ root /root/.jenkins/workspace/nestle-platform-front-test/dist;
+ }
+
+ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico|woff|woff2|ttf|eot|txt|svg)$ {
+ root /root/.jenkins/workspace/nestle-platform-front-test/dist;
+ }
+
+ error_page 404 /404.html;
+ location = /usr/share/nginx/html/40x.html {
+ }
+
+ error_page 500 502 503 504 /50x.html;
+ location = /usr/share/nginx/html/50x.html {
+ }
+
+ }
+
+ server {
+
+ listen 8002;
+ server_name localhost 127.0.0.1 139.159.190.24 store.gitnavi.com;
+
+ location / {
+ root /root/.jenkins/workspace/nestle-store-front-test/dist;
+ index index.html index.htm;
+ try_files $uri /index.html;
+ }
+
+ location ^~ /store/ {
+ proxy_pass http://127.0.0.1:28082;
+ proxy_redirect off;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ }
+
+ location ~ .*\.(js|css)?$ {
+ root /root/.jenkins/workspace/nestle-store-front-test/dist;
+ }
+
+ location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico|woff|woff2|ttf|eot|txt|svg)$ {
+ root /root/.jenkins/workspace/nestle-store-front-test/dist;
+ }
+
+ error_page 404 /404.html;
+ location = /usr/share/nginx/html/40x.html {
+ }
+
+ error_page 500 502 503 504 /50x.html;
+ location = /usr/share/nginx/html/50x.html {
+ }
+
+ }
+}
diff --git a/favorite-file/Tomcat-Settings/server.xml b/favorite-file/Tomcat-Settings/server.xml
new file mode 100644
index 00000000..fef02cf1
--- /dev/null
+++ b/favorite-file/Tomcat-Settings/server.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/favorite-file/gravitee-docker-compose/README.md b/favorite-file/gravitee-docker-compose/README.md
new file mode 100644
index 00000000..e4983ec9
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/README.md
@@ -0,0 +1,32 @@
+# graviteeio api gateway docker-compose running
+
+fork from graviteeio project && change some deps image
+
+-
+-
+
+## how to run
+
+```code
+cd platform && docker-compose up -d
+```
+
+## manager ui
+
+* api portal
+
+```code
+open https://localhost/apim/portal
+```
+
+* access manager ui
+
+```code
+open https://localhost/am/ui/
+```
+
+## Note:
+
+- environments directory has some demos with ci && traefik gateway
+- portal account admin amdin
+- access manager ui account admin adminadmin
\ No newline at end of file
diff --git a/favorite-file/gravitee-docker-compose/environments/ci/docker-compose.yml b/favorite-file/gravitee-docker-compose/environments/ci/docker-compose.yml
new file mode 100644
index 00000000..37c9c07c
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/environments/ci/docker-compose.yml
@@ -0,0 +1,62 @@
+#-------------------------------------------------------------------------------
+# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#-------------------------------------------------------------------------------
+version: '2'
+
+services:
+ ci:
+ image: graviteeio/jenkins:latest
+ container_name: ci
+ network_mode: "bridge"
+ expose:
+ - 50022
+ ports:
+ - "50022:50022"
+ labels:
+ - "traefik.frontend.rule=Host:ci.gravitee.io"
+ - "traefik.port=8080"
+ volumes:
+ - /var/jenkins_home:/var/jenkins_home
+ - /var/run/docker.sock:/var/run/docker.sock
+ links:
+ - redis-test
+ - qa
+
+ redis-test:
+ image: redis:3
+ container_name: redis-test
+ network_mode: "bridge"
+
+ qa:
+ image: sonarqube:alpine
+ container_name: qa
+ network_mode: "bridge"
+ environment:
+ - SONARQUBE_JDBC_URL=jdbc:postgresql://sonarqube-db:5432/sonar
+ labels:
+ - "traefik.frontend.rule=Host:qa.gravitee.io"
+ volumes:
+ - /opt/sonarqube/conf:/opt/sonarqube/conf
+ - /opt/sonarqube/data:/opt/sonarqube/data
+ - /opt/sonarqube/extensions:/opt/sonarqube/extensions
+ - /opt/sonarqube/bundled-plugins:/opt/sonarqube/lib/bundled-plugins
+ links:
+ - sonarqube-db
+
+ sonarqube-db:
+ image: postgres:alpine
+ network_mode: "bridge"
+ environment:
+ - POSTGRES_USER=sonar
+ - POSTGRES_PASSWORD=sonar
+ volumes:
+ - /opt/sonarqube/postgresql/data:/var/lib/postgresql/data
diff --git a/favorite-file/gravitee-docker-compose/environments/demo/common.yml b/favorite-file/gravitee-docker-compose/environments/demo/common.yml
new file mode 100644
index 00000000..a1d7c696
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/environments/demo/common.yml
@@ -0,0 +1,62 @@
+#-------------------------------------------------------------------------------
+# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#-------------------------------------------------------------------------------
+version: '2'
+
+volumes:
+ datamongo: {}
+ dataelasticsearch: {}
+
+services:
+ elasticsearch:
+ hostname: demo-elasticsearch
+ image: docker.elastic.co/elasticsearch/elasticsearch:5.4.3
+ volumes:
+ - dataelasticsearch:/usr/share/elasticsearch/data
+ environment:
+ - http.host=0.0.0.0
+ - transport.host=0.0.0.0
+ - xpack.security.enabled=false
+ - xpack.monitoring.enabled=false
+ - cluster.name=elasticsearch
+ - bootstrap.memory_lock=true
+ - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
+ ulimits:
+ memlock:
+ soft: -1
+ hard: -1
+ nofile: 65536
+
+ mongodb:
+ hostname: demo-mongodb
+ image: mongo:3.4
+ volumes:
+ - datamongo:/data/db
+
+ gateway:
+ hostname: demo-gateway
+ image: graviteeio/gateway:latest
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_ratelimit_mongodb_uri=mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_reporters_elasticsearch_endpoints_0=http://elasticsearch:9200
+
+ managementui:
+ hostname: demo-managementui
+ image: graviteeio/management-ui:latest
+
+ managementapi:
+ hostname: demo-managementapi
+ image: graviteeio/management-api:latest
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_analytics_elasticsearch_endpoints_0=http://elasticsearch:9200
diff --git a/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-local.yml b/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-local.yml
new file mode 100644
index 00000000..38c34e4c
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-local.yml
@@ -0,0 +1,76 @@
+#-------------------------------------------------------------------------------
+# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#-------------------------------------------------------------------------------
+version: '2'
+
+volumes:
+ local_datamongo: {}
+ local_dataelasticsearch: {}
+
+services:
+ local_elasticsearch:
+ extends:
+ file: common.yml
+ service: elasticsearch
+ volumes:
+ - local_dataelasticsearch:/usr/share/elasticsearch/data
+ - ./logs/elasticsearch:/var/log/elasticsearch
+
+ local_mongodb:
+ extends:
+ file: common.yml
+ service: mongodb
+ volumes:
+ - local_datamongo:/data/db
+ - ./logs/mongodb:/var/log/mongodb
+
+ local_gateway:
+ extends:
+ file: common.yml
+ service: gateway
+ links:
+ - "local_mongodb:demo-mongodb"
+ - "local_elasticsearch:demo-elasticsearch"
+ ports:
+ - "8000:8082"
+ volumes:
+ - ./logs/gateway:/etc/gravitee.io/log
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_ratelimit_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_reporters_elasticsearch_endpoints_0=http://demo-elasticsearch:9200
+
+ local_managementui:
+ extends:
+ file: common.yml
+ service: managementui
+ ports:
+ - "8002:80"
+ volumes:
+ - ./logs/management-ui:/var/log/httpd
+ environment:
+ - MGMT_API_URL=http:\/\/localhost:8005\/management\/
+
+ local_managementapi:
+ extends:
+ file: common.yml
+ service: managementapi
+ ports:
+ - "8005:8083"
+ volumes:
+ - ./logs/management-api:/home/gravitee/logs
+ links:
+ - "local_mongodb:demo-mongodb"
+ - "local_elasticsearch:demo-elasticsearch"
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_analytics_elasticsearch_endpoints_0=http://demo-elasticsearch:9200
diff --git a/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-traefik-latest.yml b/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-traefik-latest.yml
new file mode 100644
index 00000000..e3ea6bce
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-traefik-latest.yml
@@ -0,0 +1,76 @@
+#-------------------------------------------------------------------------------
+# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#-------------------------------------------------------------------------------
+version: '2'
+
+volumes:
+ latest_datamongo: {}
+ latest_dataelasticsearch: {}
+
+services:
+ latest_elasticsearch:
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: elasticsearch
+ volumes:
+ - latest_dataelasticsearch:/usr/share/elasticsearch/data
+
+ latest_mongodb:
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: mongodb
+ volumes:
+ - latest_datamongo:/data/db
+
+ latest_gateway:
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: gateway
+ links:
+ - latest_mongodb
+ - latest_elasticsearch
+ labels:
+ - "traefik.backend=graviteeio-gateway"
+ - "traefik.frontend.rule=Host:demo.gravitee.io;PathPrefixStrip:/gateway"
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_ratelimit_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_reporters_elasticsearch_endpoints_0=http://demo-elasticsearch:9200
+
+ latest_managementui:
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: managementui
+ labels:
+ - "traefik.backend=graviteeio-managementui"
+ - "traefik.frontend.rule=Host:demo.gravitee.io"
+ environment:
+ - MGMT_API_URL=https:\/\/demo.gravitee.io\/management\/
+
+ latest_managementapi:
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: managementapi
+ labels:
+ - "traefik.backend=graviteeio-managementapi"
+ - "traefik.frontend.rule=Host:demo.gravitee.io;PathPrefix:/management"
+ links:
+ - latest_mongodb
+ - latest_elasticsearch
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_analytics_elasticsearch_endpoints_0=http://demo-elasticsearch:9200
\ No newline at end of file
diff --git a/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-traefik-nightly.yml b/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-traefik-nightly.yml
new file mode 100644
index 00000000..2369851c
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/environments/demo/docker-compose-traefik-nightly.yml
@@ -0,0 +1,79 @@
+#-------------------------------------------------------------------------------
+# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#-------------------------------------------------------------------------------
+version: '2'
+
+volumes:
+ nightly_datamongo: {}
+ nightly_dataelasticsearch: {}
+
+services:
+ nightly_elasticsearch:
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: elasticsearch
+ volumes:
+ - nightly_dataelasticsearch:/usr/share/elasticsearch/data
+
+ nightly_mongodb:
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: mongodb
+ volumes:
+ - nightly_datamongo:/data/db
+
+ nightly_gateway:
+ image: graviteeio/gateway:nightly
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: gateway
+ links:
+ - nightly_mongodb
+ - nightly_elasticsearch
+ labels:
+ - "traefik.backend=nightly-graviteeio-gateway"
+ - "traefik.frontend.rule=Host:nightly.gravitee.io;PathPrefixStrip:/gateway"
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_ratelimit_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_reporters_elasticsearch_endpoints_0=http://demo-elasticsearch:9200
+
+ nightly_managementui:
+ image: graviteeio/management-ui:nightly
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: managementui
+ labels:
+ - "traefik.backend=nightly-graviteeio-managementui"
+ - "traefik.frontend.rule=Host:nightly.gravitee.io"
+ environment:
+ - MGMT_API_URL=https:\/\/nightly.gravitee.io\/management\/
+
+ nightly_managementapi:
+ image: graviteeio/management-api:nightly
+ network_mode: "bridge"
+ extends:
+ file: common.yml
+ service: managementapi
+ labels:
+ - "traefik.backend=nightly-graviteeio-managementapi"
+ - "traefik.frontend.rule=Host:nightly.gravitee.io;PathPrefix:/management"
+ links:
+ - nightly_mongodb
+ - nightly_elasticsearch
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://demo-mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_analytics_elasticsearch_endpoints_0=http://demo-elasticsearch:9200
\ No newline at end of file
diff --git a/favorite-file/gravitee-docker-compose/environments/demo/launch.sh b/favorite-file/gravitee-docker-compose/environments/demo/launch.sh
new file mode 100755
index 00000000..ff51ff04
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/environments/demo/launch.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+#-------------------------------------------------------------------------------
+# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#-------------------------------------------------------------------------------
+
+readonly WORKDIR="$HOME/graviteeio-demo"
+readonly DIRNAME=`dirname $0`
+readonly PROGNAME=`basename $0`
+readonly color_title='\033[32m'
+readonly color_text='\033[1;36m'
+
+# OS specific support (must be 'true' or 'false').
+declare cygwin=false
+declare darwin=false
+declare linux=false
+declare dc_exec="docker-compose -f docker-compose-local.yml up"
+
+welcome() {
+ echo
+ echo -e " ${color_title} _____ _____ __ _______ _______ ______ ______ _____ ____ \033[0m"
+ echo -e " ${color_title} / ____| __ \ /\ \ / /_ _|__ __| ____| ____| |_ _/ __ \ \033[0m"
+ echo -e " ${color_title}| | __| |__) | / \ \ / / | | | | | |__ | |__ | || | | | \033[0m"
+ echo -e " ${color_title}| | |_ | _ / / /\ \ \/ / | | | | | __| | __| | || | | | \033[0m"
+ echo -e " ${color_title}| |__| | | \ \ / ____ \ / _| |_ | | | |____| |____ _ _| || |__| | \033[0m"
+ echo -e " ${color_title} \_____|_| \_\/_/ \_\/ |_____| |_| |______|______(_)_____\____/ \033[0m"
+ echo -e " ${color_title} | | \033[0m${color_text}http://gravitee.io\033[0m"
+ echo -e " ${color_title} __| | ___ _ __ ___ ___ \033[0m"
+ echo -e " ${color_title} / _\` |/ _ \ '_ \` _ \ / _ \ \033[0m"
+ echo -e " ${color_title}| (_| | __/ | | | | | (_) | \033[0m"
+ echo -e " ${color_title} \__,_|\___|_| |_| |_|\___/ \033[0m"
+ echo
+}
+
+init_env() {
+ local dockergrp
+ # define env
+ case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Darwin*)
+ darwin=true
+ ;;
+
+ Linux)
+ linux=true
+ ;;
+ esac
+
+ # test if docker must be run with sudo
+ dockergrp=$(groups | grep -c docker)
+ if [[ $darwin == false && $dockergrp == 0 ]]; then
+ dc_exec="sudo $dc_exec";
+ fi
+}
+
+init_dirs() {
+ echo "Init log directory in $WORKDIR ..."
+ mkdir -p "$WORKDIR/logs/"
+ echo
+}
+
+main() {
+ welcome
+ init_env
+ if [[ $? != 0 ]]; then
+ exit 1
+ fi
+ set -e
+ init_dirs
+ pushd $WORKDIR > /dev/null
+ echo "Download docker compose files ..."
+ curl -L https://raw.githubusercontent.com/gravitee-io/gravitee-docker/master/environments/demo/common.yml -o "common.yml"
+ curl -L https://raw.githubusercontent.com/gravitee-io/gravitee-docker/master/environments/demo/docker-compose-local.yml -o "docker-compose-local.yml"
+ echo
+ echo "Launch GraviteeIO demo ..."
+ $dc_exec
+ popd > /dev/null
+}
+
+main
diff --git a/favorite-file/gravitee-docker-compose/environments/sample-apis/docker-compose-sample-apis.yml b/favorite-file/gravitee-docker-compose/environments/sample-apis/docker-compose-sample-apis.yml
new file mode 100644
index 00000000..10c1a074
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/environments/sample-apis/docker-compose-sample-apis.yml
@@ -0,0 +1,47 @@
+#-------------------------------------------------------------------------------
+# Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#-------------------------------------------------------------------------------
+version: '2'
+
+services:
+
+ sample-api-index:
+ image: graviteeio/gravitee-sample-index:latest
+ network_mode: "bridge"
+ labels:
+ - "traefik.backend=gravitee-sample-index"
+ - "traefik.frontend.rule=Host:api.gravitee.io"
+ - "traefik.frontend.entryPoints=https"
+
+ sample-api-echo:
+ image: graviteeio/gravitee-echo-api:nightly
+ network_mode: "bridge"
+ labels:
+ - "traefik.backend=gravitee-echo-api"
+ - "traefik.frontend.rule=Host:api.gravitee.io;PathPrefix:/echo"
+ - "traefik.frontend.entryPoints=https"
+
+ sample-api-whoami:
+ image: graviteeio/gravitee-whoami-api:latest
+ network_mode: "bridge"
+ labels:
+ - "traefik.backend=gravitee-whoami-api"
+ - "traefik.frontend.rule=Host:api.gravitee.io;PathPrefix:/whoami"
+ - "traefik.frontend.entryPoints=https"
+
+ sample-api-whattimeisit:
+ image: graviteeio/gravitee-whattimeisit-api:latest
+ network_mode: "bridge"
+ labels:
+ - "traefik.backend=gravitee-whattimeisit-api"
+ - "traefik.frontend.rule=Host:api.gravitee.io;PathPrefix:/whattimeisit"
+ - "traefik.frontend.entryPoints=https"
diff --git a/favorite-file/gravitee-docker-compose/platform/docker-compose.yml b/favorite-file/gravitee-docker-compose/platform/docker-compose.yml
new file mode 100644
index 00000000..3771102c
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/platform/docker-compose.yml
@@ -0,0 +1,135 @@
+version: '3'
+
+networks:
+ default:
+
+services:
+ nginx:
+ image: nginx:1.15-alpine
+ container_name: gio_platform_nginx
+ volumes:
+ - ./nginx/nginx.conf:/etc/nginx/nginx.conf
+ - ./nginx/ssl/gio-selfsigned.crt:/etc/ssl/certs/gio-selfsigned.crt
+ - ./nginx/ssl/gio-selfsigned.key:/etc/ssl/private/gio-selfsigned.key
+ - ./nginx/ssl/gio.pem:/etc/ssl/certs/gio.pem
+ ports:
+ - "80:80"
+ - "443:443"
+ depends_on:
+ - apim_gateway
+ - apim_portal
+ - apim_management
+ - am_gateway
+ - am_management
+ - am_webui
+
+ mongodb:
+ image: mongo:3.4
+ container_name: gio_platform_mongo
+ ports:
+ - 27017:27017
+ environment:
+ - MONGO_INITDB_DATABASE=gravitee
+ volumes:
+ - ./mongo/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
+ - ./data/mongo:/data/db
+ - ./logs/mongodb:/var/log/mongodb
+
+ elasticsearch:
+ image: elasticsearch:6.4.0
+ container_name: gio_platform_elasticsearch
+ ports:
+ - 9200:9200
+ environment:
+ - http.host=0.0.0.0
+ - transport.host=0.0.0.0
+ - xpack.security.enabled=false
+ - xpack.monitoring.enabled=false
+ - cluster.name=elasticsearch
+ ulimits:
+ nofile: 65536
+ volumes:
+ - ./data/elasticsearch:/usr/share/elasticsearch/data
+ - ./logs/elasticsearch:/var/log/elasticsearch
+
+ apim_gateway:
+ image: graviteeio/gateway:latest
+ container_name: gio_platform_apim_gateway
+ volumes:
+ - ./logs/apim-gateway:/opt/graviteeio-gateway/logs
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_ratelimit_mongodb_uri=mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_reporters_elasticsearch_endpoints_0=http://elasticsearch:9200
+ - gravitee_services_metrics_enabled=true
+ - gravitee_services_metrics_prometheus.enabled=true
+ depends_on:
+ - mongodb
+ - elasticsearch
+
+ apim_portal:
+ image: graviteeio/management-ui:latest
+ container_name: gio_platform_apim_portal
+ environment:
+ - MGMT_API_URL=https:\/\/localhost\/apim\/management\/
+ depends_on:
+ - apim_management
+
+ apim_management:
+ image: graviteeio/management-api:latest
+ container_name: gio_platform_apim_mgmt_api
+ volumes:
+ - ./logs/apim-management-api:/opt/graviteeio-management-api/logs
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_ratelimit_mongodb_uri=mongodb://mongodb:27017/gravitee?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_analytics_elasticsearch_endpoints_0=http://elasticsearch:9200
+ - gravitee_jwt_cookiepath=/apim/management
+ - gravitee_jwt_cookiesecure=true
+ depends_on:
+ - mongodb
+ - elasticsearch
+
+ am_gateway:
+ image: graviteeio/am-gateway:2
+ container_name: gio_platform_am_gateway
+ volumes:
+ - ./logs/am-gateway:/opt/graviteeio-am-gateway/logs
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://mongodb:27017/gravitee-am?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_oauth2_mongodb_uri=mongodb://mongodb:27017/gravitee-am?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ depends_on:
+ - mongodb
+
+ am_management:
+ image: graviteeio/am-management-api:2
+ container_name: gio_platform_am_management
+ volumes:
+ - ./logs/am-management-api:/opt/graviteeio-am-management-api/logs
+ environment:
+ - gravitee_management_mongodb_uri=mongodb://mongodb:27017/gravitee-am?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_oauth2_mongodb_uri=mongodb://mongodb:27017/gravitee-am?serverSelectionTimeoutMS=5000&connectTimeoutMS=5000&socketTimeoutMS=5000
+ - gravitee_jwt_cookiepath=/am/management
+ - gravitee_jwt_cookiesecure=true
+ depends_on:
+ - mongodb
+ grafana:
+ image: grafana/grafana
+ ports:
+ - "3000:3000"
+ prometheus:
+ image: prom/prometheus
+ volumes:
+ - "./prometheus.yml:/etc/prometheus/prometheus.yml"
+ ports:
+ - "9090:9090"
+ am_webui:
+ image: graviteeio/am-management-ui:2
+ container_name: gio_platform_am_webui
+ environment:
+ - MGMT_API_URL=https:\/\/localhost\/am\/
+ - MGMT_UI_URL=https:\/\/localhost\/am\/ui\/
+ volumes:
+ - ./logs/am-webui:/var/log/nginx
+ depends_on:
+ - am_management
diff --git a/favorite-file/gravitee-docker-compose/platform/mongo/docker-entrypoint-initdb.d/create-index.js b/favorite-file/gravitee-docker-compose/platform/mongo/docker-entrypoint-initdb.d/create-index.js
new file mode 100644
index 00000000..b6f2d379
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/platform/mongo/docker-entrypoint-initdb.d/create-index.js
@@ -0,0 +1,92 @@
+
+// "apis" collection
+db.apis.dropIndexes();
+db.apis.createIndex( { "visibility" : 1 } );
+db.apis.createIndex( { "group" : 1 } );
+db.apis.reIndex();
+
+// "applications" collection
+db.applications.dropIndexes();
+db.applications.createIndex( { "group" : 1 } );
+db.applications.createIndex( { "name" : 1 } );
+db.applications.createIndex( { "status" : 1 } );
+db.applications.reIndex();
+
+// "events" collection
+db.events.dropIndexes();
+db.events.createIndex( { "type" : 1 } );
+db.events.createIndex( { "updatedAt" : 1 } );
+db.events.createIndex( { "properties.api_id" : 1 } );
+db.events.createIndex( { "properties.api_id":1, "type":1} );
+db.events.reIndex();
+
+// "plans" collection
+db.plans.dropIndexes();
+db.plans.createIndex( { "apis" : 1 } );
+db.plans.reIndex();
+
+// "subscriptions" collection
+db.subscriptions.dropIndexes();
+db.subscriptions.createIndex( { "plan" : 1 } );
+db.subscriptions.createIndex( { "application" : 1 } );
+db.subscriptions.reIndex();
+
+// "keys" collection
+db.keys.dropIndexes();
+db.keys.createIndex( { "plan" : 1 } );
+db.keys.createIndex( { "application" : 1 } );
+db.keys.createIndex( { "updatedAt" : 1 } );
+db.keys.createIndex( { "revoked" : 1 } );
+db.keys.createIndex( { "plan" : 1 , "revoked" : 1, "updatedAt" : 1 } );
+db.keys.reIndex();
+
+// "pages" collection
+db.pages.dropIndexes();
+db.pages.createIndex( { "api" : 1 } );
+db.pages.reIndex();
+
+// "memberships" collection
+db.memberships.dropIndexes();
+db.memberships.createIndex( {"_id.userId":1, "_id.referenceId":1, "_id.referenceType":1}, { unique: true } );
+db.memberships.createIndex( {"_id.referenceId":1, "_id.referenceType":1} );
+db.memberships.createIndex( {"_id.referenceId":1, "_id.referenceType":1, "roles":1} );
+db.memberships.createIndex( {"_id.userId":1, "_id.referenceType":1} );
+db.memberships.createIndex( {"_id.userId":1, "_id.referenceType":1, "roles":1} );
+db.memberships.reIndex();
+
+// "roles" collection
+db.roles.dropIndexes();
+db.roles.createIndex( {"_id.scope": 1 } );
+db.roles.reIndex();
+
+// "audits" collection
+db.audits.dropIndexes();
+db.audits.createIndex( { "referenceType": 1, "referenceId": 1 } );
+db.audits.createIndex( { "createdAt": 1 } );
+db.audits.reIndex();
+
+// "rating" collection
+db.rating.dropIndexes();
+db.rating.createIndex( { "api" : 1 } );
+db.rating.reIndex();
+
+// "ratingAnswers" collection
+db.ratingAnswers.dropIndexes();
+db.ratingAnswers.createIndex( { "rating" : 1 } );
+
+// "portalnotifications" collection
+db.portalnotifications.dropIndexes();
+db.portalnotifications.createIndex( { "user" : 1 } );
+db.portalnotifications.reIndex();
+
+// "portalnotificationconfigs" collection
+db.portalnotificationconfigs.dropIndexes();
+db.portalnotificationconfigs.createIndex( {"_id.user":1, "_id.referenceId":1, "_id.referenceType":1}, { unique: true } );
+db.portalnotificationconfigs.createIndex( {"_id.referenceId":1, "_id.referenceType":1, "hooks":1});
+db.portalnotificationconfigs.reIndex();
+
+// "genericnotificationconfigs" collection
+db.genericnotificationconfigs.dropIndexes();
+db.genericnotificationconfigs.createIndex( {"referenceId":1, "referenceType":1, "hooks":1});
+db.genericnotificationconfigs.createIndex( {"referenceId":1, "referenceType":1});
+db.genericnotificationconfigs.reIndex();
diff --git a/favorite-file/gravitee-docker-compose/platform/nginx/nginx.conf b/favorite-file/gravitee-docker-compose/platform/nginx/nginx.conf
new file mode 100644
index 00000000..d08fc26c
--- /dev/null
+++ b/favorite-file/gravitee-docker-compose/platform/nginx/nginx.conf
@@ -0,0 +1,133 @@
+worker_processes 4;
+
+events { worker_connections 1024; }
+
+http {
+ include /etc/nginx/mime.types;
+ resolver 127.0.0.11 ipv6=off;
+
+ upstream apim_management {
+ server apim_management:8083;
+ }
+
+ upstream apim_gateway {
+ server apim_gateway:8082;
+ }
+
+ upstream apim_portal {
+ server apim_portal:80;
+ }
+
+ upstream am_management {
+ server am_management:8093;
+ }
+
+ upstream am_gateway {
+ server am_gateway:8092;
+ }
+
+ upstream am_webui {
+ server am_webui:80;
+ }
+
+ server {
+ listen 80;
+ server_name localhost;
+ return 301 https://$server_name$request_uri; #Redirection
+ }
+
+ server {
+ listen 443 ssl;
+ listen [::]:443 ssl;
+
+ server_name localhost;
+
+ ssl_certificate /etc/ssl/certs/gio-selfsigned.crt;
+ ssl_certificate_key /etc/ssl/private/gio-selfsigned.key;
+ ssl_dhparam /etc/ssl/certs/gio.pem;
+
+ error_page 500 502 503 504 /50x.html;
+
+ location /apim/portal/ {
+ proxy_pass http://apim_portal/;
+ proxy_redirect $scheme://$host:$server_port/ $scheme://$http_host/apim/portal/;
+ 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-Forwarded-Host $server_name;
+ }
+
+ location /apim/management/ {
+ proxy_pass http://apim_management/management/;
+ proxy_redirect $scheme://$host:$server_port/management/ /apim/management/;
+ sub_filter "/management/" "/apim/management/";
+ sub_filter_types application/json;
+ sub_filter_once off;
+ proxy_cookie_path /management /apim/management;
+ 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-Forwarded-Host $server_name;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ }
+
+ location /apim/ {
+ proxy_pass http://apim_gateway/;
+ proxy_cookie_path / /apim;
+ 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-Forwarded-Host $server_name;
+ }
+
+ location /am/ui/ {
+ proxy_pass http://am_webui/;
+ 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-Forwarded-Host $server_name;
+ sub_filter '/dev/null 2>&1
+}
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart|configtest)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart| reload|orce-reload}"
+ exit 2
+esac
\ No newline at end of file
diff --git a/favorite-file/shell/crontab-redis-restart.sh b/favorite-file/shell/crontab-redis-restart.sh
new file mode 100644
index 00000000..b566416c
--- /dev/null
+++ b/favorite-file/shell/crontab-redis-restart.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+redis-cli -h 127.0.0.1 -p 6379 -a 123456789 shutdown
+
+sleep 5s
+
+/usr/local/bin/redis-server /etc/redis.conf
+
+
diff --git a/favorite-file/shell/crontab-test.sh b/favorite-file/shell/crontab-test.sh
new file mode 100644
index 00000000..8490bbeb
--- /dev/null
+++ b/favorite-file/shell/crontab-test.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+time1=$(date "+%Y-%m-%d %H:%M:%S")
+
+echo "${time1}" >> /opt/1.txt
+
+sleep 5s
+
+time2=$(date "+%Y-%m-%d %H:%M:%S")
+
+echo "${time2}" >> /opt/1.txt
diff --git a/favorite-file/shell/install_common_tool_CentOS.sh b/favorite-file/shell/install_common_tool_CentOS.sh
new file mode 100644
index 00000000..541da34f
--- /dev/null
+++ b/favorite-file/shell/install_common_tool_CentOS.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+echo "开始常用工具安装"
+
+yum install -y zip unzip lrzsz git epel-release wget htop deltarpm
+
+echo "开始常用工具结束"
\ No newline at end of file
diff --git a/favorite-file/shell/install_common_tool_ubuntu.sh b/favorite-file/shell/install_common_tool_ubuntu.sh
new file mode 100644
index 00000000..3d808206
--- /dev/null
+++ b/favorite-file/shell/install_common_tool_ubuntu.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+echo "开始常用工具安装"
+
+sudo apt-get install -y zip unzip unrar lrzsz git wget htop
+
+echo "开始常用工具结束"
\ No newline at end of file
diff --git a/favorite-file/shell/install_common_vim.sh b/favorite-file/shell/install_common_vim.sh
new file mode 100644
index 00000000..3c8b1e1f
--- /dev/null
+++ b/favorite-file/shell/install_common_vim.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+
+echo "-----------------------------------------开始常用工具安装"
+yum install -y zip unzip lrzsz git epel-release
+
+echo "-----------------------------------------开始安装 vim"
+yum install -y vim
+
+echo "-----------------------------------------设置 vim 配置"
+curl https://raw.githubusercontent.com/wklken/vim-for-server/master/vimrc > ~/.vimrc
+
diff --git a/favorite-file/shell/install_common_vim_zsh.sh b/favorite-file/shell/install_common_vim_zsh.sh
new file mode 100644
index 00000000..64e4f1c1
--- /dev/null
+++ b/favorite-file/shell/install_common_vim_zsh.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+echo "-----------------------------------------禁用防火墙"
+systemctl stop firewalld.service
+systemctl disable firewalld.service
+
+echo "-----------------------------------------开始常用工具安装"
+yum install -y zip unzip lrzsz git epel-release
+
+echo "-----------------------------------------开始常用工具结束"
+echo "-----------------------------------------开始安装 zsh"
+yum install -y zsh
+
+echo "-----------------------------------------开始安装 oh-my-zsh"
+wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
+
+echo "-----------------------------------------设置默认终端为 oh-my-zsh"
+chsh -s /bin/zsh root
+
+
+echo "-----------------------------------------开始安装 vim"
+yum install -y vim
+
+echo "-----------------------------------------设置 vim 配置"
+curl https://raw.githubusercontent.com/wklken/vim-for-server/master/vimrc > ~/.vimrc
+
diff --git a/favorite-file/shell/install_docker_centos7.sh b/favorite-file/shell/install_docker_centos7.sh
new file mode 100644
index 00000000..fe8e8550
--- /dev/null
+++ b/favorite-file/shell/install_docker_centos7.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+echo "安装 docker 所需环境"
+
+yum install -y yum-utils device-mapper-persistent-data lvm2
+
+echo "添加 repo(可能网络会很慢,有时候会报:Timeout,所以要多试几次)"
+
+yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
+yum makecache fast
+
+echo "开始安装 docker"
+
+yum install -y docker-ce
+
+echo "启动 Docker"
+
+systemctl start docker.service
+
+echo "安装结束"
+
+echo "运行 hello world 镜像"
+
+docker run hello-world
+
+
+echo "安装 docker compose"
+
+curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
+
+chmod +x /usr/local/bin/docker-compose
+
+echo "输出 docker compose 版本号"
+
+docker-compose --version
+systemctl restart docker.service
+systemctl enable docker.service
\ No newline at end of file
diff --git a/favorite-file/shell/install_docker_disable_firewalld_centos7-aliyun.sh b/favorite-file/shell/install_docker_disable_firewalld_centos7-aliyun.sh
new file mode 100644
index 00000000..587ca77b
--- /dev/null
+++ b/favorite-file/shell/install_docker_disable_firewalld_centos7-aliyun.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+echo "-----------------------------------------禁用防火墙"
+systemctl stop firewalld.service
+systemctl disable firewalld.service
+
+echo "-----------------------------------------安装 docker 所需环境"
+
+yum install -y yum-utils device-mapper-persistent-data lvm2
+
+echo "-----------------------------------------添加 repo(可能网络会很慢,有时候会报:Timeout,所以要多试几次)"
+echo "-----------------------------------------官网的地址 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo"
+echo "-----------------------------------------这里用阿里云进行加速,不然可能会出现无法安装,阿里云官网说明:https://help.aliyun.com/document_detail/60742.html"
+
+yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
+yum makecache fast
+
+echo "-----------------------------------------开始安装 docker"
+
+yum install -y docker-ce
+
+echo "-----------------------------------------启动 Docker"
+
+systemctl start docker.service
+
+echo "-----------------------------------------安装结束"
+
+echo "-----------------------------------------docker 加速"
+
+touch /etc/docker/daemon.json
+
+cat << EOF >> /etc/docker/daemon.json
+{
+ "registry-mirrors": ["https://ldhc17y9.mirror.aliyuncs.com"]
+}
+EOF
+
+systemctl daemon-reload
+systemctl restart docker
+
+echo "-----------------------------------------运行 hello world 镜像"
+
+docker run hello-world
+
+echo "-----------------------------------------安装 docker compose"
+echo "docker compose 的版本检查:https://docs.docker.com/compose/install/#install-compose"
+
+curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
+
+chmod +x /usr/local/bin/docker-compose
+
+echo "-----------------------------------------输出 docker compose 版本号"
+
+docker-compose --version
+
+
+
+
diff --git a/favorite-file/shell/install_docker_disable_firewalld_centos7.sh b/favorite-file/shell/install_docker_disable_firewalld_centos7.sh
new file mode 100644
index 00000000..5b69cd09
--- /dev/null
+++ b/favorite-file/shell/install_docker_disable_firewalld_centos7.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+echo "-----------------------------------------禁用防火墙"
+systemctl stop firewalld.service
+systemctl disable firewalld.service
+
+
+echo "-----------------------------------------安装 docker 所需环境"
+
+yum install -y yum-utils device-mapper-persistent-data lvm2
+
+echo "-----------------------------------------添加 repo(可能网络会很慢,有时候会报:Timeout,所以要多试几次)"
+
+yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
+yum makecache fast
+
+echo "-----------------------------------------开始安装 docker"
+
+yum install -y docker-ce
+
+echo "-----------------------------------------启动 Docker"
+
+systemctl start docker.service
+
+echo "-----------------------------------------安装结束"
+
+echo "-----------------------------------------运行 hello world 镜像"
+
+docker run hello-world
+
+echo "-----------------------------------------安装 docker compose"
+echo "docker compose 的版本检查:https://docs.docker.com/compose/install/#install-compose"
+
+curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
+
+chmod +x /usr/local/bin/docker-compose
+
+echo "-----------------------------------------输出 docker compose 版本号"
+
+docker-compose --version
+systemctl restart docker.service
+systemctl enable docker.service
+
+
+
diff --git a/favorite-file/shell/install_docker_k8s_disable_firewalld_centos7-aliyun.sh b/favorite-file/shell/install_docker_k8s_disable_firewalld_centos7-aliyun.sh
new file mode 100644
index 00000000..66adafa2
--- /dev/null
+++ b/favorite-file/shell/install_docker_k8s_disable_firewalld_centos7-aliyun.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+echo "-----------------------------------------禁用防火墙"
+systemctl stop firewalld.service
+systemctl disable firewalld.service
+
+echo "-----------------------------------------安装 docker 所需环境"
+
+yum install -y yum-utils device-mapper-persistent-data lvm2
+
+echo "-----------------------------------------添加 repo(可能网络会很慢,有时候会报:Timeout,所以要多试几次)"
+echo "-----------------------------------------官网的地址 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo"
+echo "-----------------------------------------这里用阿里云进行加速,不然可能会出现无法安装,阿里云官网说明:https://help.aliyun.com/document_detail/60742.html"
+
+yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
+yum makecache fast
+
+echo "-----------------------------------------开始安装 docker"
+
+yum install -y docker-ce-18.06.1.ce-3.el7
+
+echo "-----------------------------------------启动 Docker"
+
+systemctl start docker.service
+systemctl enable docker.service
+
+echo "-----------------------------------------安装结束"
+
+echo "-----------------------------------------docker 加速"
+
+touch /etc/docker/daemon.json
+
+cat << EOF >> /etc/docker/daemon.json
+{
+ "registry-mirrors": ["https://ldhc17y9.mirror.aliyuncs.com"]
+}
+EOF
+
+systemctl daemon-reload
+systemctl restart docker
+
+echo "-----------------------------------------运行 hello world 镜像"
+
+docker run hello-world
+
+
+
+
+
diff --git a/favorite-file/shell/install_jdk_offline_to_bash.sh b/favorite-file/shell/install_jdk_offline_to_bash.sh
new file mode 100644
index 00000000..1b60aeb0
--- /dev/null
+++ b/favorite-file/shell/install_jdk_offline_to_bash.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "判断 JDK 压缩包是否存在"
+
+if [ ! -f "/opt/setups/jdk-8u181-linux-x64.tar.gz" ]; then
+ echo "JDK 压缩包不存在"
+ exit 1
+fi
+
+echo "开始解压 JDK"
+cd /opt/setups ; tar -zxf jdk-8u181-linux-x64.tar.gz
+
+if [ ! -d "/opt/setups/jdk1.8.0_181" ]; then
+ echo "JDK 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "JDK 解压包移到 /usr/local/ 目录下"
+mv jdk1.8.0_181/ /usr/local/
+
+echo "JDK 写入系统变量到 profile"
+
+cat << EOF >> /etc/profile
+
+# JDK
+JAVA_HOME=/usr/local/jdk1.8.0_181
+JRE_HOME=\$JAVA_HOME/jre
+PATH=\$PATH:\$JAVA_HOME/bin
+CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
+export JAVA_HOME
+export JRE_HOME
+export PATH
+export CLASSPATH
+
+EOF
+
+
+echo "JDK 设置完成,需要你手动设置:source /etc/profile"
\ No newline at end of file
diff --git a/favorite-file/shell/install_jdk_offline_to_zsh.sh b/favorite-file/shell/install_jdk_offline_to_zsh.sh
new file mode 100644
index 00000000..0c0c091b
--- /dev/null
+++ b/favorite-file/shell/install_jdk_offline_to_zsh.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "判断 JDK 压缩包是否存在"
+
+if [ ! -f "/opt/setups/jdk-8u191-linux-x64.tar.gz" ]; then
+ echo "JDK 压缩包不存在"
+ exit 1
+fi
+
+echo "开始解压 JDK"
+cd /opt/setups ; tar -zxf jdk-8u191-linux-x64.tar.gz
+
+if [ ! -d "/opt/setups/jdk1.8.0_191" ]; then
+ echo "JDK 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "JDK 解压包移到 /usr/local/ 目录下"
+mv jdk1.8.0_191/ /usr/local/
+
+echo "JDK 写入系统变量到 zshrc"
+
+cat << EOF >> ~/.zshrc
+
+# JDK
+JAVA_HOME=/usr/local/jdk1.8.0_191
+JRE_HOME=\$JAVA_HOME/jre
+PATH=\$PATH:\$JAVA_HOME/bin
+CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
+export JAVA_HOME
+export JRE_HOME
+export PATH
+export CLASSPATH
+
+EOF
+
+
+echo "JDK 设置完成,需要你手动设置:source ~/.zshrc"
\ No newline at end of file
diff --git a/favorite-file/shell/install_jdk_online.sh b/favorite-file/shell/install_jdk_online.sh
new file mode 100644
index 00000000..d55e05dd
--- /dev/null
+++ b/favorite-file/shell/install_jdk_online.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+if [ ! -d "/usr/program" ]; then
+ mkdir /usr/program
+fi
+
+echo "下载 JDK"
+
+cd /opt/setups
+wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
+
+if [ ! -f "/opt/setups/jdk-8u151-linux-x64.tar.gz" ]; then
+ echo "JDK 下载失败,结束脚本"
+ exit 1
+fi
+
+echo "JDK 下载成功,开始解压 JDK"
+tar -zxf jdk-8u151-linux-x64.tar.gz
+
+if [ ! -d "/opt/setups/jdk1.8.0_151" ]; then
+ echo "JDK 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "JDK 解压包移到 /usr/program/ 目录下"
+mv jdk1.8.0_151/ /usr/program/
+
+echo "JDK 写入系统变量到 zshrc"
+
+cat << EOF >> ~/.zshrc
+
+# JDK
+JAVA_HOME=/usr/local/jdk1.8.0_151
+JRE_HOME=\$JAVA_HOME/jre
+PATH=\$PATH:\$JAVA_HOME/bin
+CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
+export JAVA_HOME
+export JRE_HOME
+export PATH
+export CLASSPATH
+EOF
+
+echo "JDK 设置完成,需要你手动设置:source ~/.zshrc"
\ No newline at end of file
diff --git a/favorite-file/shell/install_maven_offline_to_bash.sh b/favorite-file/shell/install_maven_offline_to_bash.sh
new file mode 100644
index 00000000..179cf3fa
--- /dev/null
+++ b/favorite-file/shell/install_maven_offline_to_bash.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "判断 Maven 压缩包是否存在"
+
+if [ ! -f "/opt/setups/apache-maven-3.5.4-bin.tar.gz" ]; then
+ echo "Maven 压缩包不存在"
+ exit 1
+fi
+
+echo "开始解压 Maven"
+cd /opt/setups ; tar -zxf apache-maven-3.5.4-bin.tar.gz
+
+if [ ! -d "/opt/setups/apache-maven-3.5.4" ]; then
+ echo "Maven 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "Maven 解压包移到 /usr/local/ 目录下"
+mv apache-maven-3.5.4/ /usr/local/
+
+echo "Maven 写入系统变量到 profile"
+
+cat << EOF >> /etc/profile
+
+# Maven
+M3_HOME=/usr/local/apache-maven-3.5.4
+MAVEN_HOME=/usr/local/apache-maven-3.5.4
+PATH=\$PATH:\$M3_HOME/bin
+MAVEN_OPTS="-Xms256m -Xmx356m"
+export M3_HOME
+export MAVEN_HOME
+export PATH
+export MAVEN_OPTS
+
+EOF
+
+
+echo "Maven 设置完成,需要你手动设置:source /etc/profile"
\ No newline at end of file
diff --git a/favorite-file/shell/install_maven_offline_to_zsh.sh b/favorite-file/shell/install_maven_offline_to_zsh.sh
new file mode 100644
index 00000000..2454bb59
--- /dev/null
+++ b/favorite-file/shell/install_maven_offline_to_zsh.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "判断 Maven 压缩包是否存在"
+
+if [ ! -f "/opt/setups/apache-maven-3.5.4-bin.tar.gz" ]; then
+ echo "Maven 压缩包不存在"
+ exit 1
+fi
+
+echo "开始解压 Maven"
+cd /opt/setups ; tar -zxf apache-maven-3.5.4-bin.tar.gz
+
+if [ ! -d "/opt/setups/apache-maven-3.5.4" ]; then
+ echo "Maven 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "Maven 解压包移到 /usr/local/ 目录下"
+mv apache-maven-3.5.4/ /usr/local/
+
+echo "Maven 写入系统变量到 zshrc"
+
+cat << EOF >> ~/.zshrc
+
+# Maven
+M3_HOME=/usr/local/apache-maven-3.5.4
+MAVEN_HOME=/usr/local/apache-maven-3.5.4
+PATH=\$PATH:\$M3_HOME/bin
+MAVEN_OPTS="-Xms256m -Xmx356m"
+export M3_HOME
+export MAVEN_HOME
+export PATH
+export MAVEN_OPTS
+
+EOF
+
+
+echo "Maven 设置完成,需要你手动设置:source ~/.zshrc"
\ No newline at end of file
diff --git a/favorite-file/shell/install_mycat_offline.sh b/favorite-file/shell/install_mycat_offline.sh
new file mode 100644
index 00000000..eb0ee862
--- /dev/null
+++ b/favorite-file/shell/install_mycat_offline.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "判断是否有 JDK 环境"
+
+if [ -z $JAVA_HOME ];then
+ echo "没有 JAVA_HOME 环境变量"
+ exit 1
+fi
+
+echo "判断 /opt 目录下 mycat 压缩包是否存在"
+
+if [ ! -f "/opt/setups/Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz" ]; then
+ echo "mycat 压缩包是否存在不存在"
+ exit 1
+fi
+
+echo "解压压缩包"
+
+cd /opt/setups ; tar -zxf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz
+
+echo "把解压后目录移到 /usr/local/ 目录下"
+mv /opt/setups/mycat /usr/local/
+
+echo "写入系统变量到 zshrc"
+
+echo 'MYCAT_HOME=/usr/local/mycat' >> ~/.zshrc
+echo 'PATH=$PATH:$MYCAT_HOME/bin' >> ~/.zshrc
+echo 'export MYCAT_HOME' >> ~/.zshrc
+echo 'export PATH' >> ~/.zshrc
+echo "mycat 设置完成,需要你手动设置:source ~/.zshrc"
+
+
diff --git a/favorite-file/shell/install_mysql5.6_offline_centos6.sh b/favorite-file/shell/install_mysql5.6_offline_centos6.sh
new file mode 100644
index 00000000..ee1b499f
--- /dev/null
+++ b/favorite-file/shell/install_mysql5.6_offline_centos6.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+echo "安装 mysql 开始"
+
+cd /opt/setups
+
+tar zxvf mysql-5.6.35.tar.gz
+
+mv /opt/setups/mysql-5.6.35 /usr/program/
+
+yum install -y make gcc-c++ cmake bison-devel ncurses-devel
+
+cd /usr/program/mysql-5.6.35/
+
+mkdir -p /usr/program/mysql/data
+
+cmake -DCMAKE_INSTALL_PREFIX=/usr/program/mysql -DMYSQL_DATADIR=/usr/program/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1
+
+make
+
+make install
+
+cp /usr/program/mysql-5.6.35/support-files/mysql.server /etc/init.d/mysql
+
+chmod 755 /etc/init.d/mysql
+
+chkconfig mysql on
+
+cp /usr/program/mysql-5.6.35/support-files/my-default.cnf /etc/my.cnf
+
+rm -rf /usr/program/mysql-5.6.35/
+
+groupadd mysql
+
+useradd -g mysql mysql -s /bin/false
+
+chown -R mysql:mysql /usr/program/mysql/data
+
+/usr/program/mysql/scripts/mysql_install_db --basedir=/usr/program/mysql --datadir=/usr/program/mysql/data --skip-name-resolve --user=mysql
+
+ln -s /usr/program/mysql/bin/mysql /usr/bin
+
+ln -s /usr/program/mysql/bin/mysqladmin /usr/bin
+
+ln -s /usr/program/mysql/bin/mysqldump /usr/bin
+
+ln -s /usr/program/mysql/bin/mysqlslap /usr/bin
+
+iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
+
+service iptables save
+
+service iptables restart
+
+echo "安装 mysql 结束,现在需要手动设置防火墙和禁用 selinux."
\ No newline at end of file
diff --git a/favorite-file/shell/install_mysql5.6_offline_centos7.sh b/favorite-file/shell/install_mysql5.6_offline_centos7.sh
new file mode 100644
index 00000000..e030a3dc
--- /dev/null
+++ b/favorite-file/shell/install_mysql5.6_offline_centos7.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+echo "安装 mysql 开始"
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "判断 JDK 压缩包是否存在"
+
+if [ ! -f "/opt/setups/mysql-5.6.35.tar.gz" ]; then
+ echo "mysql 压缩包不存在"
+ exit 1
+fi
+
+cd /opt/setups
+
+tar zxvf mysql-5.6.35.tar.gz
+
+mv /opt/setups/mysql-5.6.35 /usr/local/
+
+yum install -y make gcc-c++ cmake bison-devel ncurses-devel autoconf
+
+cd /usr/local/mysql-5.6.35/
+
+mkdir -p /usr/local/mysql/data
+
+cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1
+
+make
+
+make install
+
+cp /usr/local/mysql-5.6.35/support-files/mysql.server /etc/init.d/mysql
+
+chmod 755 /etc/init.d/mysql
+
+chkconfig mysql on
+
+cp /usr/local/mysql-5.6.35/support-files/my-default.cnf /etc/my.cnf
+
+rm -rf /usr/local/mysql-5.6.35/
+
+groupadd mysql
+
+useradd -g mysql mysql -s /bin/false
+
+chown -R mysql:mysql /usr/local/mysql/data
+
+/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --skip-name-resolve --user=mysql
+
+ln -s /usr/local/mysql/bin/mysql /usr/bin
+
+ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
+
+ln -s /usr/local/mysql/bin/mysqldump /usr/bin
+
+ln -s /usr/local/mysql/bin/mysqlslap /usr/bin
+
+echo "防火墙放行 3306 端口"
+systemctl restart firewalld.service
+firewall-cmd --zone=public --add-port=3306/tcp --permanent
+firewall-cmd --reload
+systemctl stop firewalld.service
+
+echo "安装 mysql 结束,现在需要手动设置防火墙和禁用 selinux."
\ No newline at end of file
diff --git a/favorite-file/shell/install_mysql5.7_offline_centos7.sh b/favorite-file/shell/install_mysql5.7_offline_centos7.sh
new file mode 100644
index 00000000..6ea0b3cb
--- /dev/null
+++ b/favorite-file/shell/install_mysql5.7_offline_centos7.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+echo "安装 mysql 开始"
+echo "必须准备两个文件:mysql-5.7.21.tar.gz 和 boost_1_59_0.tar.gz"
+echo "mysql 5.7 依赖 boost,官网说明:https://dev.mysql.com/doc/mysql-sourcebuild-excerpt/5.7/en/source-installation.html"
+echo "boost 下载地址(79M):http://www.boost.org/users/history/version_1_59_0.html"
+
+if [ ! -f "/opt/setups/mysql-5.7.21.tar.gz" ]; then
+ echo "缺少 mysql-5.7.21.tar.gz 文件,结束脚本"
+ exit 1
+fi
+
+if [ ! -f "/opt/setups/boost_1_59_0.tar.gz" ]; then
+ echo "缺少 boost_1_59_0.tar.gz 文件,结束脚本"
+ exit 1
+fi
+
+cd /opt/setups
+
+tar zxvf mysql-5.7.21.tar.gz
+
+mv /opt/setups/mysql-5.7.21 /usr/local/
+
+tar zxvf boost_1_59_0.tar.gz
+
+mv /opt/setups/boost_1_59_0 /usr/local/
+
+yum install -y make gcc-c++ cmake bison-devel ncurses-devel
+
+cd /usr/local/mysql-5.7.21/
+
+mkdir -p /usr/local/mysql/data
+
+cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_BOOST=/usr/local/boost_1_59_0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1
+
+make
+
+make install
+
+cp /usr/local/mysql-5.7.21/support-files/mysql.server /etc/init.d/mysql
+
+chmod 755 /etc/init.d/mysql
+
+chkconfig mysql on
+
+echo "mysql 5.7 这个文件没了,需要自己创建一个"
+
+cp /usr/local/mysql-5.7.21/support-files/my-default.cnf /etc/my.cnf
+
+rm -rf /usr/local/mysql-5.7.21/
+
+groupadd mysql
+
+useradd -g mysql mysql -s /bin/false
+
+chown -R mysql:mysql /usr/local/mysql/data
+
+/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --skip-name-resolve --user=mysql
+
+ln -s /usr/local/mysql/bin/mysql /usr/bin
+
+ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
+
+ln -s /usr/local/mysql/bin/mysqldump /usr/bin
+
+ln -s /usr/local/mysql/bin/mysqlslap /usr/bin
+
+echo "防火墙放行 3306 端口"
+systemctl restart firewalld.service
+firewall-cmd --zone=public --add-port=3306/tcp --permanent
+firewall-cmd --reload
+systemctl stop firewalld.service
+
+echo "安装 mysql 结束,现在需要手动设置防火墙和禁用 selinux."
\ No newline at end of file
diff --git a/favorite-file/shell/install_nginx_centos6.sh b/favorite-file/shell/install_nginx_centos6.sh
new file mode 100644
index 00000000..b80f78b5
--- /dev/null
+++ b/favorite-file/shell/install_nginx_centos6.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+
+echo "安装 nginx"
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+if [ ! -d "/usr/program" ]; then
+ mkdir /usr/program
+fi
+
+if [ ! -d "/usr/local/nginx" ]; then
+ mkdir -p /usr/local/nginx
+fi
+
+if [ ! -d "/var/log/nginx" ]; then
+ mkdir -p /var/log/nginx
+fi
+
+if [ ! -d "/var/temp/nginx" ]; then
+ mkdir -p /var/temp/nginx
+fi
+
+if [ ! -d "/var/lock/nginx" ]; then
+ mkdir -p /var/lock/nginx
+fi
+
+echo "下载 Nginx"
+
+cd /opt/setups
+wget https://nginx.org/download/nginx-1.12.2.tar.gz
+
+if [ ! -f "/opt/setups/nginx-1.12.2.tar.gz" ]; then
+ echo "Nginx 下载失败,结束脚本"
+ exit 1
+fi
+
+echo "Nginx 下载成功,开始解压 Nginx"
+tar -zxf nginx-1.12.2.tar.gz
+
+if [ ! -d "/opt/setups/nginx-1.12.2" ]; then
+ echo "Nginx 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "安装源码安装依赖"
+yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
+
+echo "开始安装 Nginx"
+cd nginx-1.12.2/
+
+./configure --prefix=/usr/local/nginx --pid-path=/var/local/nginx/nginx.pid --lock-path=/var/lock/nginx/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --with-http_ssl_module --http-scgi-temp-path=/var/temp/nginx/scgi
+make
+make install
+
+echo "防火墙放行 80 端口"
+iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
+service iptables save
+service iptables restart
+
+echo "启动 Nginx"
+/usr/local/nginx/sbin/nginx
diff --git a/favorite-file/shell/install_nginx_centos7.sh b/favorite-file/shell/install_nginx_centos7.sh
new file mode 100644
index 00000000..f2bd28eb
--- /dev/null
+++ b/favorite-file/shell/install_nginx_centos7.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+
+echo "安装 nginx"
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+if [ ! -d "/usr/local/nginx" ]; then
+ mkdir -p /usr/local/nginx
+fi
+
+if [ ! -d "/var/log/nginx" ]; then
+ mkdir -p /var/log/nginx
+fi
+
+if [ ! -d "/var/temp/nginx" ]; then
+ mkdir -p /var/temp/nginx
+fi
+
+if [ ! -d "/var/lock/nginx" ]; then
+ mkdir -p /var/lock/nginx
+fi
+
+echo "下载 Nginx"
+
+cd /opt/setups
+wget https://nginx.org/download/nginx-1.14.0.tar.gz
+
+if [ ! -f "/opt/setups/nginx-1.14.0.tar.gz" ]; then
+ echo "Nginx 下载失败,结束脚本"
+ exit 1
+fi
+
+echo "Nginx 下载成功,开始解压 Nginx"
+tar -zxf nginx-1.14.0.tar.gz
+
+if [ ! -d "/opt/setups/nginx-1.14.0" ]; then
+ echo "Nginx 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "安装源码安装依赖"
+yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
+
+echo "开始安装 Nginx"
+cd nginx-1.14.0/
+
+./configure --prefix=/usr/local/nginx --pid-path=/var/local/nginx/nginx.pid --lock-path=/var/lock/nginx/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --http-client-body-temp-path=/var/temp/nginx/client --http-proxy-temp-path=/var/temp/nginx/proxy --http-fastcgi-temp-path=/var/temp/nginx/fastcgi --http-uwsgi-temp-path=/var/temp/nginx/uwsgi --with-http_ssl_module --http-scgi-temp-path=/var/temp/nginx/scgi
+make
+make install
+
+echo "防火墙放行 80 端口"
+systemctl restart firewalld.service
+firewall-cmd --zone=public --add-port=80/tcp --permanent
+firewall-cmd --reload
+systemctl restart firewalld.service
+
+echo "启动 Nginx"
+/usr/local/nginx/sbin/nginx
diff --git a/favorite-file/shell/install_redis_centos6.sh b/favorite-file/shell/install_redis_centos6.sh
new file mode 100644
index 00000000..8a3e8921
--- /dev/null
+++ b/favorite-file/shell/install_redis_centos6.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+echo "安装 redis"
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+if [ ! -d "/usr/program" ]; then
+ mkdir /usr/program
+fi
+
+echo "下载 redis"
+
+cd /opt/setups
+wget http://download.redis.io/releases/redis-4.0.6.tar.gz
+
+if [ ! -f "/opt/setups/redis-4.0.6.tar.gz" ]; then
+ echo "redis 下载失败,结束脚本"
+ exit 1
+fi
+
+echo "reids 下载成功"
+
+
+echo "安装开始"
+
+yum install -y gcc-c++ tcl
+
+cd /opt/setups
+
+tar zxvf redis-4.0.6.tar.gz
+
+if [ ! -d "/opt/setups/redis-4.0.6" ]; then
+ echo "redis 解压失败,结束脚本"
+ exit 1
+fi
+
+mv redis-4.0.6/ /usr/program/
+
+cd /usr/program/redis-4.0.6
+
+make
+
+make install
+
+cp /usr/program/redis-4.0.6/redis.conf /etc/
+
+sed -i 's/daemonize no/daemonize yes/g' /etc/redis.conf
+
+echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.local
+
+iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT
+
+service iptables save
+
+service iptables restart
+
+rm -rf /usr/program/redis-4.0.6
+
+echo "安装结束"
diff --git a/favorite-file/shell/install_redis_centos7.sh b/favorite-file/shell/install_redis_centos7.sh
new file mode 100644
index 00000000..ec7246dd
--- /dev/null
+++ b/favorite-file/shell/install_redis_centos7.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+echo "安装 redis"
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "下载 redis"
+
+cd /opt/setups
+wget http://download.redis.io/releases/redis-4.0.6.tar.gz
+
+if [ ! -f "/opt/setups/redis-4.0.6.tar.gz" ]; then
+ echo "redis 下载失败,结束脚本"
+ exit 1
+fi
+
+echo "reids 下载成功"
+
+
+echo "安装开始"
+
+yum install -y gcc-c++ tcl
+
+cd /opt/setups
+
+tar zxvf redis-4.0.6.tar.gz
+
+if [ ! -d "/opt/setups/redis-4.0.6" ]; then
+ echo "redis 解压失败,结束脚本"
+ exit 1
+fi
+
+mv redis-4.0.6/ /usr/local/
+
+cd /usr/local/redis-4.0.6
+
+make
+
+make install
+
+cp /usr/local/redis-4.0.6/redis.conf /etc/
+
+sed -i 's/daemonize no/daemonize yes/g' /etc/redis.conf
+
+echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.local
+
+echo "防火墙放行 6379 端口"
+firewall-cmd --zone=public --add-port=6379/tcp --permanent
+firewall-cmd --reload
+
+rm -rf /usr/local/redis-4.0.6
+
+echo "安装结束"
diff --git a/favorite-file/shell/install_tomcat_centos6.sh b/favorite-file/shell/install_tomcat_centos6.sh
new file mode 100644
index 00000000..d0f0f474
--- /dev/null
+++ b/favorite-file/shell/install_tomcat_centos6.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+if [ ! -d "/usr/program" ]; then
+ mkdir /usr/program
+fi
+
+echo "下载 Tomcat"
+
+cd /opt/setups
+wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.0.47/bin/apache-tomcat-8.0.47.tar.gz
+
+if [ ! -f "/opt/setups/apache-tomcat-8.0.47.tar.gz" ]; then
+ echo "Tomcat 下载失败,结束脚本"
+ exit 1
+fi
+
+echo "Tomcat 下载成功,开始解压 Tomcat"
+tar -zxf apache-tomcat-8.0.47.tar.gz
+
+if [ ! -d "/opt/setups/apache-tomcat-8.0.47" ]; then
+ echo "Tomcat 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "Tomcat 解压包移到 /usr/program/ 目录下"
+mv apache-tomcat-8.0.47/ /usr/program/
+mv /usr/program/apache-tomcat-8.0.47/ /usr/program/tomcat8/
+
+echo "防火墙放行 8080 端口"
+iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
+service iptables save
+service iptables restart
+
+echo "运行 Tomcat"
+sh /usr/program/tomcat8/bin/startup.sh ; tail -200f /usr/program/tomcat8/logs/catalina.out
\ No newline at end of file
diff --git a/favorite-file/shell/install_tomcat_centos7.sh b/favorite-file/shell/install_tomcat_centos7.sh
new file mode 100644
index 00000000..c85aad61
--- /dev/null
+++ b/favorite-file/shell/install_tomcat_centos7.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+echo "下载 Tomcat"
+
+cd /opt/setups
+wget http://apache.fayea.com/tomcat/tomcat-8/v8.0.46/bin/apache-tomcat-8.0.46.tar.gz
+
+if [ ! -f "/opt/setups/apache-tomcat-8.0.46.tar.gz" ]; then
+ echo "Tomcat 下载失败,结束脚本"
+ exit 1
+fi
+
+echo "Tomcat 下载成功,开始解压 Tomcat"
+tar -zxf apache-tomcat-8.0.46.tar.gz
+
+if [ ! -d "/opt/setups/apache-tomcat-8.0.46" ]; then
+ echo "Tomcat 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "Tomcat 解压包移到 /usr/local/ 目录下"
+mv apache-tomcat-8.0.46/ /usr/local/
+mv /usr/local/apache-tomcat-8.0.46/ /usr/local/tomcat8/
+
+echo "防火墙放行 8080 端口"
+firewall-cmd --zone=public --add-port=8080/tcp --permanent
+firewall-cmd --reload
+
+echo "运行 Tomcat"
+sh /usr/local/tomcat8/bin/startup.sh ; tail -200f /usr/local/tomcat8/logs/catalina.out
\ No newline at end of file
diff --git a/favorite-file/shell/install_tomcat_offline_centos7.sh b/favorite-file/shell/install_tomcat_offline_centos7.sh
new file mode 100644
index 00000000..563756b6
--- /dev/null
+++ b/favorite-file/shell/install_tomcat_offline_centos7.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+echo "判断常见的文件夹是否存在"
+
+if [ ! -d "/opt/setups" ]; then
+ mkdir /opt/setups
+fi
+
+
+echo "判断 tomcat 压缩包是否存在"
+
+if [ ! -f "/opt/setups/apache-tomcat-8.0.46.tar.gz" ]; then
+ echo "JDK 压缩包不存在"
+ exit 1
+fi
+
+
+cd /opt/setups
+
+echo "开始解压 Tomcat"
+
+tar -zxf apache-tomcat-8.0.46.tar.gz
+
+if [ ! -d "/opt/setups/apache-tomcat-8.0.46" ]; then
+ echo "Tomcat 解压失败,结束脚本"
+ exit 1
+fi
+
+echo "Tomcat 解压包移到 /usr/local/ 目录下"
+mv apache-tomcat-8.0.46/ /usr/local/
+mv /usr/local/apache-tomcat-8.0.46/ /usr/local/tomcat8/
+
+echo "防火墙放行 8080 端口"
+firewall-cmd --zone=public --add-port=8080/tcp --permanent
+firewall-cmd --reload
+
+echo "运行 Tomcat"
+sh /usr/local/tomcat8/bin/startup.sh ; tail -200f /usr/local/tomcat8/logs/catalina.out
\ No newline at end of file
diff --git a/favorite-file/shell/mysql_backup.sh b/favorite-file/shell/mysql_backup.sh
new file mode 100644
index 00000000..541c77cb
--- /dev/null
+++ b/favorite-file/shell/mysql_backup.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+
+backupDatetime=$1
+
+if [ "$backupDatetime" = "" ];
+then
+ echo -e "\033[0;31m 请输入备份日期 \033[0m"
+ exit 1
+fi
+
+echo "备份日期 = $backupDatetime"
+
+/usr/bin/mysqldump -u root --password=123456 数据库名 > /opt/mydb-"$backupDatetime".sql
+
+
+
diff --git a/favorite-file/shell/repo_install_centos6.sh b/favorite-file/shell/repo_install_centos6.sh
new file mode 100644
index 00000000..42275ce9
--- /dev/null
+++ b/favorite-file/shell/repo_install_centos6.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+# 本文原内容来自:https://github.com/judasn/Linux-Tutorial/blob/master/CentOS-Extra-Packages.md
+
+echo "源设置开始"
+
+echo "备份默认源设置"
+sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
+cd /etc/yum.repos.d/
+
+echo "下载网易 centos6 源"
+sudo wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
+
+echo "安装网易 centos6 源"
+sudo mv CentOS6-Base-163.repo CentOS-Base.repo
+rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
+
+echo "清除缓存后更新程序"
+sudo yum clean all
+sudo yum makecache
+sudo yum update -y
+
+echo "使用第三方源"
+echo "安装 EPEL 源"
+sudo yum install -y epel-release
+rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
+
+echo "安装 RepoForge 源"
+wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
+sudo rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
+sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
+
+echo "清除缓存后更新程序"
+sudo yum clean all
+sudo yum makecache
+sudo yum update -y
+
+echo "测试安装 htop"
+sudo yum install -y htop
+
+echo "完成源设置"
+
+
+
+
+
+
+
+
+
diff --git a/favorite-file/shell/shell-for.sh b/favorite-file/shell/shell-for.sh
new file mode 100644
index 00000000..9b92b372
--- /dev/null
+++ b/favorite-file/shell/shell-for.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# 循环总次数
+totalDegree=$1
+
+# 如果没有传参,则默认值是 10
+if [ "$totalDegree" = "" ];
+then
+ totalDegree=10
+fi
+
+for((timeTemp = 0; timeTemp <= $totalDegree; timeTemp = timeTemp + 5))
+do
+ echo "timeTemp=$timeTemp"
+done
+
+
+
diff --git a/favorite-file/shell/shell-with-param-demo.sh b/favorite-file/shell/shell-with-param-demo.sh
new file mode 100644
index 00000000..f59e9a79
--- /dev/null
+++ b/favorite-file/shell/shell-with-param-demo.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+
+methodParam=$1
+SpringBoot=$2
+SpringBootPath=$3
+
+if [ "$methodParam" = "" ];
+then
+ echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
+ exit 1
+fi
+
+if [ "$SpringBoot" = "" ];
+then
+ echo -e "\033[0;31m 未输入应用名 \033[0m"
+ exit 1
+fi
+
+if [ "$SpringBootPath" = "" ];
+then
+ echo -e "\033[0;31m 未输入应用路径 \033[0m"
+ exit 1
+fi
+
+echo "操作名 = $methodParam"
+echo "应用名 = $2"
+echo "应用路径 = $3"
+
+function start()
+{
+ count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l`
+ if [ $count != 0 ];then
+ echo "$SpringBoot is running..."
+ else
+ echo "Start $SpringBoot success..."
+ cd $SpringBootPath
+ BUILD_ID=dontKillMe nohup java -jar $SpringBoot > /opt/run-log.log 2>&1 &
+ fi
+}
+
+function stop()
+{
+ echo "Stop $SpringBoot"
+ boot_id=`ps -ef |grep java|grep $SpringBoot|grep -v grep|awk '{print $2}'`
+ count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l`
+
+ if [ $count != 0 ];then
+ kill $boot_id
+ count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l`
+
+ boot_id=`ps -ef |grep java|grep $SpringBoot|grep -v grep|awk '{print $2}'`
+ kill -9 $boot_id
+ fi
+}
+
+function restart()
+{
+ stop
+ sleep 2
+ start
+}
+
+function status()
+{
+ count=`ps -ef |grep java|grep $SpringBoot|grep -v grep|wc -l`
+ if [ $count != 0 ];then
+ echo "$SpringBoot is running..."
+ else
+ echo "$SpringBoot is not running..."
+ fi
+}
+
+case $methodParam in
+ start)
+ start;;
+ stop)
+ stop;;
+ restart)
+ restart;;
+ status)
+ status;;
+ *)
+
+ echo -e "\033[0;31m Usage: \033[0m \033[0;34m sh $0 {start|stop|restart|status} {SpringBootJarName} \033[0m\033[0;31m Example: \033[0m\033[0;33m sh $0 start esmart-test.jar \033[0m"
+esac
+
+
+
diff --git a/favorite-file/zsh/.zshrc b/favorite-file/zsh/.zshrc
new file mode 100644
index 00000000..13b595b6
--- /dev/null
+++ b/favorite-file/zsh/.zshrc
@@ -0,0 +1,102 @@
+# If you come from bash you might have to change your $PATH.
+# export PATH=$HOME/bin:/usr/local/bin:$PATH
+
+# Path to your oh-my-zsh installation.
+ export ZSH=/root/.oh-my-zsh
+
+# Set name of the theme to load. Optionally, if you set this to "random"
+# it'll load a random theme each time that oh-my-zsh is loaded.
+# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
+ZSH_THEME="avit"
+
+# Uncomment the following line to use case-sensitive completion.
+# CASE_SENSITIVE="true"
+
+# Uncomment the following line to use hyphen-insensitive completion. Case
+# sensitive completion must be off. _ and - will be interchangeable.
+# HYPHEN_INSENSITIVE="true"
+
+# Uncomment the following line to disable bi-weekly auto-update checks.
+# DISABLE_AUTO_UPDATE="true"
+
+# Uncomment the following line to change how often to auto-update (in days).
+# export UPDATE_ZSH_DAYS=13
+
+# Uncomment the following line to disable colors in ls.
+# DISABLE_LS_COLORS="true"
+
+# Uncomment the following line to disable auto-setting terminal title.
+# DISABLE_AUTO_TITLE="true"
+
+# Uncomment the following line to enable command auto-correction.
+# ENABLE_CORRECTION="true"
+
+# Uncomment the following line to display red dots whilst waiting for completion.
+# COMPLETION_WAITING_DOTS="true"
+
+# Uncomment the following line if you want to disable marking untracked files
+# under VCS as dirty. This makes repository status check for large repositories
+# much, much faster.
+# DISABLE_UNTRACKED_FILES_DIRTY="true"
+
+# Uncomment the following line if you want to change the command execution time
+# stamp shown in the history command output.
+# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
+# HIST_STAMPS="mm/dd/yyyy"
+
+# Would you like to use another custom folder than $ZSH/custom?
+# ZSH_CUSTOM=/path/to/new-custom-folder
+
+# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
+# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
+# Example format: plugins=(rails git textmate ruby lighthouse)
+# Add wisely, as too many plugins slow down shell startup.
+plugins=(git)
+
+source $ZSH/oh-my-zsh.sh
+
+# User configuration
+
+# export MANPATH="/usr/local/man:$MANPATH"
+
+# You may need to manually set your language environment
+# export LANG=en_US.UTF-8
+
+# Preferred editor for local and remote sessions
+# if [[ -n $SSH_CONNECTION ]]; then
+# export EDITOR='vim'
+# else
+# export EDITOR='mvim'
+# fi
+
+# Compilation flags
+# export ARCHFLAGS="-arch x86_64"
+
+# ssh
+# export SSH_KEY_PATH="~/.ssh/rsa_id"
+
+# Set personal aliases, overriding those provided by oh-my-zsh libs,
+# plugins, and themes. Aliases can be placed here, though oh-my-zsh
+# users are encouraged to define aliases within the ZSH_CUSTOM folder.
+# For a full list of active aliases, run `alias`.
+#
+# Example aliases
+# alias zshconfig="mate ~/.zshrc"
+# alias ohmyzsh="mate ~/.oh-my-zsh"
+
+
+JAVA_HOME=/usr/program/jdk1.8.0_121
+JRE_HOME=$JAVA_HOME/jre
+PATH=$PATH:$JAVA_HOME/bin
+CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
+export JAVA_HOME
+export JRE_HOME
+export PATH
+export CLASSPATH
+
+
+
+
+
+
+
diff --git a/images/Alfresco-Install-And-Settings-a-1.jpg b/images/Alfresco-Install-And-Settings-a-1.jpg
new file mode 100644
index 00000000..47d551f2
Binary files /dev/null and b/images/Alfresco-Install-And-Settings-a-1.jpg differ
diff --git a/images/Alfresco-Install-And-Settings-a-2.jpg b/images/Alfresco-Install-And-Settings-a-2.jpg
new file mode 100644
index 00000000..78cec04b
Binary files /dev/null and b/images/Alfresco-Install-And-Settings-a-2.jpg differ
diff --git a/images/Alfresco-Install-And-Settings-a-3.jpg b/images/Alfresco-Install-And-Settings-a-3.jpg
new file mode 100644
index 00000000..7636b54c
Binary files /dev/null and b/images/Alfresco-Install-And-Settings-a-3.jpg differ
diff --git a/images/Alfresco-Install-And-Settings-a-4.jpg b/images/Alfresco-Install-And-Settings-a-4.jpg
new file mode 100644
index 00000000..d16ec53e
Binary files /dev/null and b/images/Alfresco-Install-And-Settings-a-4.jpg differ
diff --git a/images/CentOS-7-Install-a-0.jpg b/images/CentOS-7-Install-a-0.jpg
new file mode 100644
index 00000000..acc0a75b
Binary files /dev/null and b/images/CentOS-7-Install-a-0.jpg differ
diff --git a/images/CentOS-7-Install-a-1.jpg b/images/CentOS-7-Install-a-1.jpg
new file mode 100644
index 00000000..ae6fd358
Binary files /dev/null and b/images/CentOS-7-Install-a-1.jpg differ
diff --git a/images/CentOS-7-Install-a-10.jpg b/images/CentOS-7-Install-a-10.jpg
new file mode 100644
index 00000000..edaecb6f
Binary files /dev/null and b/images/CentOS-7-Install-a-10.jpg differ
diff --git a/images/CentOS-7-Install-a-11.jpg b/images/CentOS-7-Install-a-11.jpg
new file mode 100644
index 00000000..7d8a3e23
Binary files /dev/null and b/images/CentOS-7-Install-a-11.jpg differ
diff --git a/images/CentOS-7-Install-a-12.jpg b/images/CentOS-7-Install-a-12.jpg
new file mode 100644
index 00000000..193e825c
Binary files /dev/null and b/images/CentOS-7-Install-a-12.jpg differ
diff --git a/images/CentOS-7-Install-a-13.jpg b/images/CentOS-7-Install-a-13.jpg
new file mode 100644
index 00000000..4aea90ed
Binary files /dev/null and b/images/CentOS-7-Install-a-13.jpg differ
diff --git a/images/CentOS-7-Install-a-14.jpg b/images/CentOS-7-Install-a-14.jpg
new file mode 100644
index 00000000..269a7ccc
Binary files /dev/null and b/images/CentOS-7-Install-a-14.jpg differ
diff --git a/images/CentOS-7-Install-a-15.jpg b/images/CentOS-7-Install-a-15.jpg
new file mode 100644
index 00000000..760c8af8
Binary files /dev/null and b/images/CentOS-7-Install-a-15.jpg differ
diff --git a/images/CentOS-7-Install-a-16.jpg b/images/CentOS-7-Install-a-16.jpg
new file mode 100644
index 00000000..21167d4a
Binary files /dev/null and b/images/CentOS-7-Install-a-16.jpg differ
diff --git a/images/CentOS-7-Install-a-2.jpg b/images/CentOS-7-Install-a-2.jpg
new file mode 100644
index 00000000..9290b5dc
Binary files /dev/null and b/images/CentOS-7-Install-a-2.jpg differ
diff --git a/images/CentOS-7-Install-a-3.jpg b/images/CentOS-7-Install-a-3.jpg
new file mode 100644
index 00000000..9ec3185e
Binary files /dev/null and b/images/CentOS-7-Install-a-3.jpg differ
diff --git a/images/CentOS-7-Install-a-4.jpg b/images/CentOS-7-Install-a-4.jpg
new file mode 100644
index 00000000..768b9be5
Binary files /dev/null and b/images/CentOS-7-Install-a-4.jpg differ
diff --git a/images/CentOS-7-Install-a-5.jpg b/images/CentOS-7-Install-a-5.jpg
new file mode 100644
index 00000000..78fb67eb
Binary files /dev/null and b/images/CentOS-7-Install-a-5.jpg differ
diff --git a/images/CentOS-7-Install-a-6.jpg b/images/CentOS-7-Install-a-6.jpg
new file mode 100644
index 00000000..fd5f32c7
Binary files /dev/null and b/images/CentOS-7-Install-a-6.jpg differ
diff --git a/images/CentOS-7-Install-a-7.jpg b/images/CentOS-7-Install-a-7.jpg
new file mode 100644
index 00000000..ef41ed75
Binary files /dev/null and b/images/CentOS-7-Install-a-7.jpg differ
diff --git a/images/CentOS-7-Install-a-8.jpg b/images/CentOS-7-Install-a-8.jpg
new file mode 100644
index 00000000..c58e7c7c
Binary files /dev/null and b/images/CentOS-7-Install-a-8.jpg differ
diff --git a/images/CentOS-7-Install-a-9.jpg b/images/CentOS-7-Install-a-9.jpg
new file mode 100644
index 00000000..81b9696c
Binary files /dev/null and b/images/CentOS-7-Install-a-9.jpg differ
diff --git a/images/CentOS6-and-CentOS7-a-1.png b/images/CentOS6-and-CentOS7-a-1.png
new file mode 100644
index 00000000..47b69ed5
Binary files /dev/null and b/images/CentOS6-and-CentOS7-a-1.png differ
diff --git a/images/Ldap-Install-And-Settings-a-1.png b/images/Ldap-Install-And-Settings-a-1.png
new file mode 100644
index 00000000..cc04c43b
Binary files /dev/null and b/images/Ldap-Install-And-Settings-a-1.png differ
diff --git a/images/Nginx-SSL-a-1.jpg b/images/Nginx-SSL-a-1.jpg
new file mode 100644
index 00000000..6ea4ff23
Binary files /dev/null and b/images/Nginx-SSL-a-1.jpg differ
diff --git a/images/Zookeeper-Client-ZooInspector.png b/images/Zookeeper-Client-ZooInspector.png
new file mode 100644
index 00000000..7a6eff76
Binary files /dev/null and b/images/Zookeeper-Client-ZooInspector.png differ
diff --git a/images/Zookeeper-Client-zooweb.png b/images/Zookeeper-Client-zooweb.png
new file mode 100644
index 00000000..41bb2c19
Binary files /dev/null and b/images/Zookeeper-Client-zooweb.png differ
diff --git a/markdown-file/Alfresco-Install-And-Usage.md b/markdown-file/Alfresco-Install-And-Usage.md
new file mode 100644
index 00000000..dec91c07
--- /dev/null
+++ b/markdown-file/Alfresco-Install-And-Usage.md
@@ -0,0 +1,47 @@
+# Alfresco 使用
+
+## Alfresco 介绍
+
+- 官网:
+- 开源社区版下载:
+- 官网文档说明:
+- 开源社区版本安装说明:
+ - Linux 版本安装说明:
+- 我的目的:用来管理公司发布的文档,比如:Word、Excel、记事本等这类,该系统支持在线预览文件。
+
+## 环境说明
+
+- CentOS 7.3 带有图形桌面(需要有)
+- 下载下来的软件:**alfresco-community-installer-201704-linux-x64_3.bin**,大小:822M
+- 安装包存放目录:/opt
+
+## 开始安装:
+
+- 使用 Linux 桌面方式进入系统,打开终端:
+- 切换目录:`cd /opt`
+- 赋予权限:`chmod +x alfresco-community-installer-201704-linux-x64_3.bin`
+- `./alfresco-community-installer-201704-linux-x64_3.bin`
+- 然后会出现如下图这种步骤引导安装界面,带有简体中文版,选择 `简单` 的基本流程安装方式,默认都是下一步下一步。其实选择 `高级` 也基本上是下一步下一步的,只是可以看到更多细节。
+- 在设置管理员密码上,我是:123456(默认用户名是:admin)
+
+
+
+
+- 安装完成后,可以选择开始启动程序。建议不勾选,我们来使用下面命令。
+- 程序默认是安装在:**/opt/alfresco-community**
+- 所以我们需要打开终端:
+- 切换目录:`cd /opt/alfresco-community`
+- 启动程序:`./alfresco.sh start`
+- 停止程序:`./alfresco.sh stop`
+- 启动完成后,用浏览器打开:(如果你 Linux 防火墙关闭了,也可以直接用其他机子直接访问,把这台机子当做服务器用),可以看到如下内容:
+
+
+
+
+
+
+
+
+
+
+
diff --git a/markdown-file/Ansible-Install-And-Settings.md b/markdown-file/Ansible-Install-And-Settings.md
new file mode 100644
index 00000000..aed43c64
--- /dev/null
+++ b/markdown-file/Ansible-Install-And-Settings.md
@@ -0,0 +1,364 @@
+# Ansible 安装和配置
+
+
+## Ansible 说明
+
+- Ansible 官网:
+- Ansible 官网 Github:
+- Ansible 官网文档:
+- 简单讲:它的作用就是把写 shell 这件事变成标准化、模块化。方便更好的自动化运维
+
+## 安装
+
+- 官网说明:
+- CentOS:`sudo yum install -y ansible`
+ - 查看版本:`ansible --version`
+
+-------------------------------------------------------------------
+
+## 配置基本概念
+
+#### Ansible 基本配置文件顺序
+
+- Ansible 执行的时候会按照以下顺序查找配置项,所以修改的时候要特别注意改的是哪个文件
+
+```
+ANSIBLE_CONFIG (环境变量)
+ansible.cfg (脚本所在当前目录下)
+~/.ansible.cfg (用户家目录下,默认没有)
+/etc/ansible/ansible.cfg(安装后会自动生成)
+```
+
+
+#### 配置远程主机地址 (Ansible 称这些地址为 Inventory)
+
+- 假设我有 3 台机子:
+ - 192.168.0.223
+ - 192.168.0.70
+ - 192.168.0.103
+- 官网对此的配置说明:
+
+###### 给这三台机子设置免密登录的情况(一般推荐方式)
+
+- 编辑 Ansible 配置文件:`vim /etc/ansible/hosts`
+- 添加如下内容
+
+```
+[hadoop-host]
+192.168.0.223
+192.168.0.70
+192.168.0.103
+```
+
+- 其中 `[hadoop-host]` 表示这些主机代表的一个组名
+
+
+###### 如果不设置免密,直接采用账号密码(容易泄露信息)
+
+
+- 编辑 Ansible 配置文件:`vim /etc/ansible/hosts`
+- 添加如下内容
+
+```
+[hadoop-host]
+hadoop-master ansible_host=192.168.0.223 ansible_user=root ansible_ssh_pass=123456
+hadoop-node1 ansible_host=192.168.0.70 ansible_user=root ansible_ssh_pass=123456
+hadoop-node2 ansible_host=192.168.0.103 ansible_user=root ansible_ssh_pass=123456
+```
+
+
+
+## 简单使用(`ad hoc`方式)
+
+- ad hoc 官网:
+
+##### 运行 Ansible
+
+- 运行 Ansible 的 `ping` 命令,看看配置正确时输出如下:
+
+```
+sudo ansible --private-key ~/.ssh/id_rsa all -m ping
+```
+
+- 让远程所有主机都执行 `ps` 命令,输出如下
+
+```
+ansible all -a 'ps'
+```
+
+- 让远程所有 hadoop-host 组的主机都执行 `ps` 命令,输出如下
+
+```
+ansible hadoop-host -a 'ps'
+```
+
+-------------------------------------------------------------------
+
+## Playbook 脚本方式
+
+- 官网:
+- 一些语法:
+- playbook(剧本),顾名思义,就是需要定义一个脚本或者说配置文件,然后定义好要做什么。之后 ansible 就会根据 playbook 脚本对远程主机进行操作
+
+#### 简单脚本
+
+- 下面脚本让所有远程主机执行 `whoami` 命令,并把结果(当前用户名)输出到 `/opt/whoami.txt` 文件
+- 创建脚本文件:`vim /opt/simple-playbook.yml`
+
+```
+- hosts: all
+ tasks:
+ - name: whoami
+ shell: 'whoami > /opt/whoami.txt'
+```
+
+- 执行命令:`ansible-playbook /opt/simple-playbook.yml`,结果如下,并且 opt 下也有文件生成
+
+```
+PLAY [all] **************************************************************************************************************************
+
+TASK [Gathering Facts] **************************************************************************************************************
+ok: [192.168.0.223]
+ok: [192.168.0.103]
+ok: [192.168.0.70]
+
+TASK [whoami] ***********************************************************************************************************************
+changed: [192.168.0.103]
+changed: [192.168.0.223]
+changed: [192.168.0.70]
+
+PLAY RECAP **************************************************************************************************************************
+192.168.0.103 : ok=2 changed=1 unreachable=0 failed=0
+192.168.0.223 : ok=2 changed=1 unreachable=0 failed=0
+192.168.0.70 : ok=2 changed=1 unreachable=0 failed=0
+```
+
+-------------------------------------------------------------------
+
+## 平时用来测试
+
+- 创建脚本文件:`vim /opt/test-playbook.yml`
+
+```
+- hosts: hadoop-test
+ remote_user: root
+ vars:
+ java_install_folder: /usr/local
+ tasks:
+ # 按行的方式写入
+ - name: Set JAVA_HOME 1
+ lineinfile:
+ dest=/etc/profile
+ line="JAVA_HOME={{ java_install_folder }}/jdk1.8.0_181"
+ # 按块的方式写入,#{mark} 会被自动替换成:begin 和 end 字符来包裹整块内容(我这里自己定义了词语)
+ - name: Set JAVA_HOME 2
+ blockinfile:
+ path: /etc/profile
+ marker: "#{mark} JDK ENV"
+ marker_begin: "开始"
+ marker_end: "结束"
+ block: |
+ export JAVA_HOME={{ java_install_folder }}/jdk1.8.0_181
+ export PATH=$PATH:$JAVA_HOME/bin
+```
+
+- 执行命令:`ansible-playbook /opt/test-playbook.yml`
+
+-------------------------------------------------------------------
+
+## 更多 playbook 实战
+
+
+#### 禁用防火墙(CentOS 7.x)
+
+
+- 创建脚本文件:`vim /opt/disable-firewalld-playbook.yml`
+
+```
+- hosts: all
+ remote_user: root
+ tasks:
+ - name: Disable SELinux at next reboot
+ selinux:
+ state: disabled
+ - name: disable firewalld
+ command: "{{ item }}"
+ with_items:
+ - systemctl stop firewalld
+ - systemctl disable firewalld
+ - setenforce 0
+```
+
+
+
+#### 基础环境(CentOS 7.x)
+
+
+- 创建脚本文件:`vim /opt/install-basic-playbook.yml`
+
+```
+- hosts: all
+ remote_user: root
+ tasks:
+ - name: Disable SELinux at next reboot
+ selinux:
+ state: disabled
+
+ - name: disable firewalld
+ command: "{{ item }}"
+ with_items:
+ - systemctl stop firewalld
+ - systemctl disable firewalld
+ - setenforce 0
+
+ - name: install-basic
+ command: "{{ item }}"
+ with_items:
+ - yum install -y zip unzip lrzsz git epel-release wget htop deltarpm
+
+ - name: install-vim
+ shell: "{{ item }}"
+ with_items:
+ - yum install -y vim
+ - curl https://raw.githubusercontent.com/wklken/vim-for-server/master/vimrc > ~/.vimrc
+
+ - name: install-docker
+ shell: "{{ item }}"
+ with_items:
+ - yum install -y yum-utils device-mapper-persistent-data lvm2
+ - yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
+ - yum makecache fast
+ - yum install -y docker-ce
+ - systemctl start docker.service
+ - docker run hello-world
+
+ - name: install-docker-compose
+ shell: "{{ item }}"
+ with_items:
+ - curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
+ - chmod +x /usr/local/bin/docker-compose
+ - docker-compose --version
+ - systemctl restart docker.service
+ - systemctl enable docker.service
+
+```
+
+
+- 执行命令:`ansible-playbook /opt/install-basic-playbook.yml`
+
+#### 修改 hosts
+
+
+- 创建脚本文件:`vim /opt/hosts-playbook.yml`
+
+```
+- hosts: all
+ remote_user: root
+ tasks:
+ - name: update hosts
+ blockinfile:
+ path: /etc/hosts
+ block: |
+ 192.168.0.223 linux01
+ 192.168.0.223 linux02
+ 192.168.0.223 linux03
+ 192.168.0.223 linux04
+ 192.168.0.223 linux05
+```
+
+
+- 执行命令:`ansible-playbook /opt/hosts-playbook.yml`
+
+
+
+#### 部署 JDK
+
+- 创建脚本文件:`vim /opt/jdk8-playbook.yml`
+
+```
+- hosts: hadoop-host
+ remote_user: root
+ vars:
+ java_install_folder: /usr/local
+ tasks:
+ - name: copy jdk
+ copy: src=/opt/jdk-8u181-linux-x64.tar.gz dest={{ java_install_folder }}
+
+ - name: tar jdk
+ shell: chdir={{ java_install_folder }} tar zxf jdk-8u181-linux-x64.tar.gz
+
+ - name: set JAVA_HOME
+ blockinfile:
+ path: /etc/profile
+ marker: "#{mark} JDK ENV"
+ block: |
+ JAVA_HOME={{ java_install_folder }}/jdk1.8.0_181
+ JRE_HOME=$JAVA_HOME/jre
+ PATH=$PATH:$JAVA_HOME/bin
+ CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
+ export JAVA_HOME
+ export JRE_HOME
+ export PATH
+ export CLASSPATH
+
+ - name: source profile
+ shell: source /etc/profile
+```
+
+
+- 执行命令:`ansible-playbook /opt/jdk8-playbook.yml`
+
+
+
+#### 部署 Hadoop 集群
+
+- 创建脚本文件:`vim /opt/hadoop-playbook.yml`
+- 刚学 Ansible,不好动配置文件,所以就只保留环境部分的设置,其他部分自行手工~
+
+```
+- hosts: hadoop-host
+ remote_user: root
+ tasks:
+ - name: Creates directory
+ file:
+ path: /data/hadoop/hdfs/name
+ state: directory
+ - name: Creates directory
+ file:
+ path: /data/hadoop/hdfs/data
+ state: directory
+ - name: Creates directory
+ file:
+ path: /data/hadoop/hdfs/tmp
+ state: directory
+
+ - name: set HADOOP_HOME
+ blockinfile:
+ path: /etc/profile
+ marker: "#{mark} HADOOP ENV"
+ block: |
+ HADOOP_HOME=/usr/local/hadoop
+ PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
+ export HADOOP_HOME
+ export PATH
+
+ - name: source profile
+ shell: source /etc/profile
+```
+
+
+- 执行命令:`ansible-playbook /opt/hadoop-playbook.yml`
+
+
+
+
+
+-------------------------------------------------------------------
+
+
+## 资料
+
+- [ANSIBLE模块 - shell和command区别](https://www.jianshu.com/p/081139f73613)
+-
+-
+-
\ No newline at end of file
diff --git a/markdown-file/Bash-Other-Bash.md b/markdown-file/Bash-Other-Bash.md
new file mode 100644
index 00000000..2ce9fcd8
--- /dev/null
+++ b/markdown-file/Bash-Other-Bash.md
@@ -0,0 +1,31 @@
+# Bash 其他常用命令
+
+## 其他常用命令
+
+- 编辑 hosts 文件:`vim /etc/hosts`,添加内容格式:`127.0.0.1 www.youmeek.com`
+- RPM 文件操作命令:
+ - 安装
+ - `rpm -i example.rpm`,安装 example.rpm 包
+ - `rpm -iv example.rpm`,安装 example.rpm 包并在安装过程中显示正在安装的文件信息
+ - `rpm -ivh example.rpm`,安装 example.rpm 包并在安装过程中显示正在安装的文件信息及安装进度
+ - 查询
+ - `rpm -qa | grep jdk`,查看 jdk 是否被安装
+ - `rpm -ql jdk`,查看 jdk 是否被安装
+ - 卸载
+ - `rpm -e jdk`,卸载 jdk(一般卸载的时候都要先用 rpm -qa 看下整个软件的全名)
+- YUM 软件管理:
+ - `yum install -y httpd`,安装 apache
+ - `yum remove -y httpd`,卸载 apache
+ - `yum info -y httpd`,查看 apache 版本信息
+ - `yum list --showduplicates httpd`,查看可以安装的版本
+ - `yum install httpd-查询到的版本号`,安装指定版本
+ - 更多命令可以看:
+- 查看某个配置文件,排除掉里面以 # 开头的注释内容:
+ - `grep '^[^#]' /etc/openvpn/server.conf`
+- 查看某个配置文件,排除掉里面以 # 开头和 ; 开头的注释内容:
+ - `grep '^[^#;]' /etc/openvpn/server.conf`
+
+## 资料
+
+-
+
diff --git a/Bash.md b/markdown-file/Bash.md
similarity index 68%
rename from Bash.md
rename to markdown-file/Bash.md
index 231faca8..593b8ff6 100644
--- a/Bash.md
+++ b/markdown-file/Bash.md
@@ -15,7 +15,9 @@
- `pwd`,显示当前目录路径(常用)
- `firefox&`,最后后面的 **&** 符号,表示使用后台方式打开 Firefox,然后显示该进程的 PID 值
- `jobs`,查看后台运行的程序列表
-- `ifconfig`,查看 IP 等信息(常用)
+- `ifconfig`,查看内网 IP 等信息(常用)
+- `curl ifconfig.me`,查看外网 IP 信息
+- `curl ip.cn`,查看外网 IP 信息
- `locate 搜索关键字`,快速搜索系统文件/文件夹(类似 Windows 上的 everything 索引式搜索)(常用)
- `updatedb`,配合上面的 locate,给 locate 的索引更新(locate 默认是一天更新一次索引)(常用)
- `date`,查看系统时间(常用)
@@ -23,7 +25,6 @@
- `date -s18:24`,设置时间,如果要同时更改 BIOS 时间,再执行 `hwclock --systohc`(常用)
- `cal`,在终端中查看日历,肯定没有农历显示的
- `uptime`,查看系统已经运行了多久,当前有几个用户等信息(常用)
-- `echo "字符串内容"`,输出 "字符串内容"
- `cat 文件路名`,显示文件内容(属于打印语句)
- `cat -n 文件名`,显示文件,并每一行内容都编号
- `more 文件名`,用分页的方式查看文件内容(按 space 翻下一页,按 *Ctrl + B* 返回上页)
@@ -31,7 +32,6 @@
- 按 **j** 向下移动,按 **k** 向上移动
- 按 **/** 后,输入要查找的字符串内容,可以对文件进行向下查询,如果存在多个结果可以按 **n** 调到下一个结果出
- 按 **?** 后,输入要查找的字符串内容,可以对文件进行向上查询,如果存在多个结果可以按 **n** 调到下一个结果出
-- `tail -200f 文件名`,查看文件被更新的新内容尾 200 行,如果文件还有在新增可以动态查看到(一般用于查看日记文件)
- `shutdown`
- `shutdown -hnow`,立即关机
- `shutdown -h+10`,10 分钟后关机
@@ -48,28 +48,30 @@
- `last`,显示最近登录的帐户及时间
- `lastlog`,显示系统所有用户各自在最近登录的记录,如果没有登录过的用户会显示 **从未登陆过**
- `ls`,列出当前目录下的所有没有隐藏的文件 / 文件夹。
- - `ls -a`,列出包括以.号开头的隐藏文件 / 文件夹(也就是所有文件)
+ - `ls -a`,列出包括以.号开头的隐藏文件 / 文件夹(也就是所有文件)
- `ls -R`,显示出目录下以及其所有子目录的文件 / 文件夹(递归地方式,不显示隐藏的文件)
- `ls -a -R`,显示出目录下以及其所有子目录的文件 / 文件夹(递归地方式,显示隐藏的文件)
- - `ls -l`,列出目录下所有文件的权限、所有者、文件大小、修改时间及名称(也就是显示详细信息,不显示隐藏文件)。显示出来的效果如下:
-
- ``` nginx
- -rwxr-xr-x. 1 root root 4096 3月 26 10:57,其中最前面的 - 表示这是一个普通文件
- lrwxrwxrwx. 1 root root 4096 3月 26 10:57,其中最前面的 l 表示这是一个链接文件,类似 Windows 的快捷方式
- drwxr-xr-x. 5 root root 4096 3月 26 10:57,其中最前面的 d 表示这是一个目录
- ```
-
+ - `ls -al`,列出目录下所有文件(包含隐藏)的权限、所有者、文件大小、修改时间及名称(也就是显示详细信息)
- `ls -ld 目录名`,显示该目录的基本信息
- `ls -t`,依照文件最后修改时间的顺序列出文件名。
- `ls -F`,列出当前目录下的文件名及其类型。以 **/** 结尾表示为目录名,以 **\*** 结尾表示为可执行文件,以 **@** 结尾表示为符号连接
- `ls -lg`,同上,并显示出文件的所有者工作组名。
- `ls -lh`,查看文件夹类文件详细信息,文件大小,文件修改时间
- `ls /opt | head -5`,显示 opt 目录下前 5 条记录
+ - `ls -l | grep '.jar'`,查找当前目录下所有 jar 文件
- `ls -l /opt |grep "^-"|wc -l`,统计 opt 目录下文件的个数,不会递归统计
- `ls -lR /opt |grep "^-"|wc -l`,统计 opt 目录下文件的个数,会递归统计
- `ls -l /opt |grep "^d"|wc -l`,统计 opt 目录下目录的个数,不会递归统计
- `ls -lR /opt |grep "^d"|wc -l`,统计 opt 目录下目录的个数,会递归统计
- `ls -lR /opt |grep "js"|wc -l`,统计 opt 目录下 js 文件的个数,会递归统计
+ - `ls -l`,列出目录下所有文件的权限、所有者、文件大小、修改时间及名称(也就是显示详细信息,不显示隐藏文件)。显示出来的效果如下:
+
+``` nginx
+-rwxr-xr-x. 1 root root 4096 3月 26 10:57,其中最前面的 - 表示这是一个普通文件
+lrwxrwxrwx. 1 root root 4096 3月 26 10:57,其中最前面的 l 表示这是一个链接文件,类似 Windows 的快捷方式
+drwxr-xr-x. 5 root root 4096 3月 26 10:57,其中最前面的 d 表示这是一个目录
+```
+
- `cd`,目录切换
- `cd ..`,改变目录位置至当前目录的父目录(上级目录)。
- `cd ~`,改变目录位置至用户登录时的工作目录。
@@ -82,6 +84,7 @@
- `cp 源文件 目标文件`,复制文件
- `cp -r 源文件夹 目标文件夹`,复制文件夹
- `cp -r -v 源文件夹 目标文件夹`,复制文件夹(显示详细信息,一般用于文件夹很大,需要查看复制进度的时候)
+ - `cp /usr/share/easy-rsa/2.0/keys/{ca.crt,server.{crt,key},dh2048.pem,ta.key} /etc/openvpn/keys/`,复制同目录下花括号中的文件
- `tar cpf - . | tar xpf - -C /opt`,复制当前所有文件到 /opt 目录下,一般如果文件夹文件多的情况下用这个更好,用 cp 比较容易出问题
- `mv 文件 目标文件夹`,移动文件到目标文件夹
- `mv 文件`,不指定目录重命名后的名字,用来重命名文件
@@ -101,34 +104,55 @@
- `find /opt -name .oh-my-zsh`,其中 /opt 代表目录名,.oh-my-zsh 代表搜索的是隐藏文件 / 文件夹名字为 oh-my-zsh 的
- `find /opt -type f -iname .oh-my-zsh`,其中 /opt 代表目录名,-type f 代表只找文件,.oh-my-zsh 代表搜索的是隐藏文件名字为 oh-my-zsh 的
- `find /opt -type d -iname .oh-my-zsh`,其中 /opt 代表目录名,-type d 代表只找目录,.oh-my-zsh 代表搜索的是隐藏文件夹名字为 oh-my-zsh 的
- - `find . -name "lin*" -execls -l{}\;`,当前目录搜索lin开头的文件,然后用其搜索后的结果集,再执行ls -l的命令(这个命令可变,其他命令也可以),其中 -exec 和 {}\; 都是固定格式
+ - `find . -name "lin*" -exec ls -l {} \;`,当前目录搜索lin开头的文件,然后用其搜索后的结果集,再执行ls -l的命令(这个命令可变,其他命令也可以),其中 -exec 和 {} \; 都是固定格式
+ - `find /opt -type f -size +800M -print0 | xargs -0 du -h | sort -nr`,找出 /opt 目录下大于 800 M 的文件
+ - `find / -name "*tower*" -exec rm {} \;`,找到文件并删除
+ - `find / -name "*tower*" -exec mv {} /opt \;`,找到文件并移到 opt 目录
+ - `find . -name "*" |xargs grep "youmeek"`,递归查找当前文件夹下所有文件内容中包含 youmeek 的文件
+ - `find . -size 0 | xargs rm -f &`,删除当前目录下文件大小为0的文件
+ - `du -hm --max-depth=2 | sort -nr | head -12`,找出系统中占用容量最大的前 12 个目录
- `cat /etc/resolv.conf`,查看 DNS 设置
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-- ``,
-
+- `netstat -tlunp`,查看当前运行的服务,同时可以查看到:运行的程序已使用端口情况
+- `env`,查看所有系统变量
+- `export`,查看所有系统变量
+- `echo`
+ - `echo $JAVA_HOME`,查看指定系统变量的值,这里查看的是自己配置的 JAVA_HOME。
+ - `echo "字符串内容"`,输出 "字符串内容"
+ - `echo > aa.txt`,清空 aa.txt 文件内容(类似的还有:`: > aa.txt`,其中 : 是一个占位符, 不产生任何输出)
+- `unset $JAVA_HOME`,删除指定的环境变量
+- `ln -s /opt/data /opt/logs/data`,表示给 /opt/logs 目录下创建一个名为 data 的软链接,该软链接指向到 /opt/data
+- `grep`
+ - `shell grep -H '安装' *.sh`,查找当前目录下所有 sh 类型文件中,文件内容包含 `安装` 的当前行内容
+ - `grep 'test' java*`,显示当前目录下所有以 java 开头的文件中包含 test 的行
+ - `grep 'test' spring.ini docker.sh`,显示当前目录下 spring.ini docker.sh 两个文件中匹配 test 的行
+- `ps`
+ - `ps –ef|grep java`,查看当前系统中有关 java 的所有进程
+ - `ps -ef|grep --color java`,高亮显示当前系统中有关 java 的所有进程
+- `kill`
+ - `kill 1234`,结束 pid 为 1234 的进程
+ - `kill -9 1234`,强制结束 pid 为 1234 的进程(慎重)
+ - `killall java`,结束同一进程组内的所有为 java 进程
+ - `ps -ef|grep hadoop|grep -v grep|cut -c 9-15|xargs kill -9`,结束包含关键字 hadoop 的所有进程
+- `head`
+ - `head -n 10 spring.ini`,查看当前文件的前 10 行内容
+- `tail`
+ - `tail -n 10 spring.ini`,查看当前文件的后 10 行内容
+ - `tail -200f 文件名`,查看文件被更新的新内容尾 200 行,如果文件还有在新增可以动态查看到(一般用于查看日记文件)
## 用户、权限-相关命令
+- 使用 pem 证书登录:`ssh -i /opt/mykey.pem root@192.168.0.70`
+ - 证书权限不能太大,不然无法使用:`chmod 600 mykey.pem`
- `hostname`,查看当前登陆用户全名
- `cat /etc/group`,查看所有组
- `cat /etc/passwd`,查看所有用户
-- `useradd youmeek -p 123456`,添加一个名为 youmeek 的用户,还有一个同名的组
+- `groups youmeek`,查看 youmeek 用户属于哪个组
+- `useradd youmeek -g judasn`,添加用户并绑定到 judasn 组下
- `userdel -r youmeek`,删除名字为 youmeek 的用户
- 参数:`-r`,表示删除用户的时候连同用户的家目录一起删除
- 修改普通用户 youmeek 的权限跟 root 权限一样:
- 常用方法(原理是把该用户加到可以直接使用 sudo 的一个权限状态而已):
- - 编辑配置文件:``
+ - 编辑配置文件:`vim /etc/sudoers`
- 找到 98 行(预估),有一个:`root ALL=(ALL) ALL`,在这一行下面再增加一行,效果如下:
``` nginx
@@ -141,10 +165,14 @@
- 通过这两行对比,我们可以直接修改 youmeek 所在行的 UserId 值 和 GroupId 值,都改为 0。
- `groupadd judasn`,添加一个名为 judasn 的用户组
- `groupdel judasn`,删除一个名为 judasn 的用户组(前提:先删除组下面的所有用户)
+- `usermod 用户名 -g 组名`,把用户修改到其他组下
- `passwd youmeek`,修改 youmeek 用户的密码(前提:只有 root 用户才有修改其他用户的权限,其他用户只能修改自己的)
- `chmod 777 文件名/目录`,给指定文件增加最高权限,系统中的所有人都可以进行读写。
- linux 的权限分为 rwx。r 代表:可读,w 代表:可写,x 代表:可执行
- 这三个权限都可以转换成数值表示,r = 4,w = 2,x = 1,- = 0,所以总和是 7,也就是最大权限。第一个 7 是所属主(user)的权限,第二个 7 是所属组(group)的权限,最后一位 7 是非本群组用户(others)的权限。
+ - `chmod -R 777 目录` 表示递归目录下的所有文件夹,都赋予 777 权限
+ - `chown myUsername:myGroupName myFile` 表示修改文件所属用户、组
+ - `chown -R myUsername:myGroupName myFolder` 表示递归修改指定目录下的所有文件权限
- `su`:切换到 root 用户,终端目录还是原来的地方(常用)
- `su -`:切换到 root 用户,其中 **-** 号另起一个终端并切换账号
- `su 用户名`,切换指定用户帐号登陆,终端目录还是原来地方。
@@ -152,7 +180,10 @@
- `exit`,注销当前用户(常用)
- `sudo 某个命令`,使用管理员权限使用命令,使用 sudo 回车之后需要输入当前登录账号的密码。(常用)
- `passwd`,修改当前用户密码(常用)
-
+- 添加临时账号,并指定用户根目录,并只有可读权限方法
+ - 添加账号并指定根目录(用户名 tempuser):`useradd -d /data/logs -m tempuser`
+ - 设置密码:`passwd tempuser` 回车设置密码
+ - 删除用户(该用户必须退出 SSH 才能删除成功),也会同时删除组:`userdel tempuser`
## 磁盘管理
@@ -170,11 +201,15 @@
- `umount /dev/sdb5`,卸载挂载,用分区名
+## wget 下载文件
-
-
-
-
+- 常规下载:`wget http://www.gitnavi.com/index.html`
+- 自动断点下载:`wget -c http://www.gitnavi.com/index.html`
+- 后台下载:`wget -b http://www.gitnavi.com/index.html`
+- 伪装代理名称下载:`wget --user-agent="Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16" http://www.gitnavi.com/index.html`
+- 限速下载:`wget --limit-rate=300k http://www.gitnavi.com/index.html`
+- 批量下载:`wget -i /opt/download.txt`,一个下载地址一行
+- 后台批量下载:`wget -b -c -i /opt/download.txt`,一个下载地址一行
@@ -182,3 +217,4 @@
-
-
+-
diff --git a/markdown-file/CI-Install-And-Usage.md b/markdown-file/CI-Install-And-Usage.md
new file mode 100644
index 00000000..dd5bbd62
--- /dev/null
+++ b/markdown-file/CI-Install-And-Usage.md
@@ -0,0 +1,310 @@
+
+
+# CI 一整套服务
+
+## 环境说明
+
+- CentOS 7.3
+- 两台机子(一台机子也是可以,内存至少要 8G)
+ - 一台:Gitlab + Redis + Postgresql
+ - 硬件推荐:内存 4G
+ - 端口安排
+ - Gitlab:10080
+ - 一台:Nexus + Jenkins + SonarQube + Postgresql
+ - 硬件推荐:内存 8G
+ - 端口安排
+ - SonarQube:19000
+ - Nexus:18081
+ - Jenkins:18080
+
+## Gitlab + Redis + Postgresql
+
+- 预计会使用内存:2G 左右
+- 这套方案来自(部分内容根据自己情况进行了修改):
+- 创建宿主机挂载目录:`mkdir -p /data/docker/gitlab/gitlab /data/docker/gitlab/redis /data/docker/gitlab/postgresql`
+- 赋权(避免挂载的时候,一些程序需要容器中的用户的特定权限使用):`chmod -R 777 /data/docker/gitlab/gitlab /data/docker/gitlab/redis /data/docker/gitlab/postgresql`
+- 这里使用 docker-compose 的启动方式,所以需要创建 docker-compose.yml 文件:
+
+```yaml
+version: '2'
+
+services:
+ redis:
+ restart: always
+ image: sameersbn/redis:latest
+ command:
+ - --loglevel warning
+ volumes:
+ - /data/docker/gitlab/redis:/var/lib/redis:Z
+
+ postgresql:
+ restart: always
+ image: sameersbn/postgresql:9.6-2
+ volumes:
+ - /data/docker/gitlab/postgresql:/var/lib/postgresql:Z
+ environment:
+ - DB_USER=gitlab
+ - DB_PASS=password
+ - DB_NAME=gitlabhq_production
+ - DB_EXTENSION=pg_trgm
+
+ gitlab:
+ restart: always
+ image: sameersbn/gitlab:10.4.2-1
+ depends_on:
+ - redis
+ - postgresql
+ ports:
+ - "10080:80"
+ - "10022:22"
+ volumes:
+ - /data/docker/gitlab/gitlab:/home/git/data:Z
+ environment:
+ - DEBUG=false
+
+ - DB_ADAPTER=postgresql
+ - DB_HOST=postgresql
+ - DB_PORT=5432
+ - DB_USER=gitlab
+ - DB_PASS=password
+ - DB_NAME=gitlabhq_production
+
+ - REDIS_HOST=redis
+ - REDIS_PORT=6379
+
+ - TZ=Asia/Shanghai
+ - GITLAB_TIMEZONE=Beijing
+
+ - GITLAB_HTTPS=false
+ - SSL_SELF_SIGNED=false
+
+ - GITLAB_HOST=192.168.0.105
+ - GITLAB_PORT=10080
+ - GITLAB_SSH_PORT=10022
+ - GITLAB_RELATIVE_URL_ROOT=
+ - GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alphanumeric-string
+ - GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alphanumeric-string
+ - GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alphanumeric-string
+
+ - GITLAB_ROOT_PASSWORD=
+ - GITLAB_ROOT_EMAIL=
+
+ - GITLAB_NOTIFY_ON_BROKEN_BUILDS=true
+ - GITLAB_NOTIFY_PUSHER=false
+
+ - GITLAB_EMAIL=notifications@example.com
+ - GITLAB_EMAIL_REPLY_TO=noreply@example.com
+ - GITLAB_INCOMING_EMAIL_ADDRESS=reply@example.com
+
+ - GITLAB_BACKUP_SCHEDULE=daily
+ - GITLAB_BACKUP_TIME=01:00
+
+ - SMTP_ENABLED=false
+ - SMTP_DOMAIN=www.example.com
+ - SMTP_HOST=smtp.gmail.com
+ - SMTP_PORT=587
+ - SMTP_USER=mailer@example.com
+ - SMTP_PASS=password
+ - SMTP_STARTTLS=true
+ - SMTP_AUTHENTICATION=login
+
+ - IMAP_ENABLED=false
+ - IMAP_HOST=imap.gmail.com
+ - IMAP_PORT=993
+ - IMAP_USER=mailer@example.com
+ - IMAP_PASS=password
+ - IMAP_SSL=true
+ - IMAP_STARTTLS=false
+
+ - OAUTH_ENABLED=false
+ - OAUTH_AUTO_SIGN_IN_WITH_PROVIDER=
+ - OAUTH_ALLOW_SSO=
+ - OAUTH_BLOCK_AUTO_CREATED_USERS=true
+ - OAUTH_AUTO_LINK_LDAP_USER=false
+ - OAUTH_AUTO_LINK_SAML_USER=false
+ - OAUTH_EXTERNAL_PROVIDERS=
+
+ - OAUTH_CAS3_LABEL=cas3
+ - OAUTH_CAS3_SERVER=
+ - OAUTH_CAS3_DISABLE_SSL_VERIFICATION=false
+ - OAUTH_CAS3_LOGIN_URL=/cas/login
+ - OAUTH_CAS3_VALIDATE_URL=/cas/p3/serviceValidate
+ - OAUTH_CAS3_LOGOUT_URL=/cas/logout
+
+ - OAUTH_GOOGLE_API_KEY=
+ - OAUTH_GOOGLE_APP_SECRET=
+ - OAUTH_GOOGLE_RESTRICT_DOMAIN=
+
+ - OAUTH_FACEBOOK_API_KEY=
+ - OAUTH_FACEBOOK_APP_SECRET=
+
+ - OAUTH_TWITTER_API_KEY=
+ - OAUTH_TWITTER_APP_SECRET=
+
+ - OAUTH_GITHUB_API_KEY=
+ - OAUTH_GITHUB_APP_SECRET=
+ - OAUTH_GITHUB_URL=
+ - OAUTH_GITHUB_VERIFY_SSL=
+
+ - OAUTH_GITLAB_API_KEY=
+ - OAUTH_GITLAB_APP_SECRET=
+
+ - OAUTH_BITBUCKET_API_KEY=
+ - OAUTH_BITBUCKET_APP_SECRET=
+
+ - OAUTH_SAML_ASSERTION_CONSUMER_SERVICE_URL=
+ - OAUTH_SAML_IDP_CERT_FINGERPRINT=
+ - OAUTH_SAML_IDP_SSO_TARGET_URL=
+ - OAUTH_SAML_ISSUER=
+ - OAUTH_SAML_LABEL="Our SAML Provider"
+ - OAUTH_SAML_NAME_IDENTIFIER_FORMAT=urn:oasis:names:tc:SAML:2.0:nameid-format:transient
+ - OAUTH_SAML_GROUPS_ATTRIBUTE=
+ - OAUTH_SAML_EXTERNAL_GROUPS=
+ - OAUTH_SAML_ATTRIBUTE_STATEMENTS_EMAIL=
+ - OAUTH_SAML_ATTRIBUTE_STATEMENTS_NAME=
+ - OAUTH_SAML_ATTRIBUTE_STATEMENTS_FIRST_NAME=
+ - OAUTH_SAML_ATTRIBUTE_STATEMENTS_LAST_NAME=
+
+ - OAUTH_CROWD_SERVER_URL=
+ - OAUTH_CROWD_APP_NAME=
+ - OAUTH_CROWD_APP_PASSWORD=
+
+ - OAUTH_AUTH0_CLIENT_ID=
+ - OAUTH_AUTH0_CLIENT_SECRET=
+ - OAUTH_AUTH0_DOMAIN=
+
+ - OAUTH_AZURE_API_KEY=
+ - OAUTH_AZURE_API_SECRET=
+ - OAUTH_AZURE_TENANT_ID=
+```
+
+
+- 启动:`docker-compose up -d`,启动比较慢,等个 2 分钟左右。
+- 浏览器访问 Gitlab:
+ - 默认用户是 root,密码首次访问必须重新设置,并且最小长度为 8 位,我习惯设置为:aa123456
+ - 添加 SSH key:
+- Gitlab 的具体使用可以看另外文章:[Gitlab 的使用](Gitlab-Install-And-Settings.md)
+
+## Nexus + Jenkins + SonarQube
+
+- 预计会使用内存:4G 左右
+- 创建宿主机挂载目录:`mkdir -p /data/docker/ci/nexus /data/docker/ci/jenkins /data/docker/ci/jenkins/lib /data/docker/ci/jenkins/home /data/docker/ci/sonarqube /data/docker/ci/postgresql /data/docker/ci/gatling/results`
+- 赋权(避免挂载的时候,一些程序需要容器中的用户的特定权限使用):`chmod -R 777 /data/docker/ci/nexus /data/docker/ci/jenkins/lib /data/docker/ci/jenkins/home /data/docker/ci/sonarqube /data/docker/ci/postgresql /data/docker/ci/gatling/results`
+- 下面有一个细节要特别注意:yml 里面不能有中文。还有就是 sonar 的挂载目录不能直接挂在 /opt/sonarqube 上,不然会启动不了。
+- 这里使用 docker-compose 的启动方式,所以需要创建 docker-compose.yml 文件:
+
+```yaml
+version: '3'
+
+networks:
+ prodnetwork:
+ driver: bridge
+
+services:
+ sonardb:
+ image: postgres:9.6.6
+ restart: always
+ ports:
+ - "5433:5432"
+ networks:
+ - prodnetwork
+ volumes:
+ - /data/docker/ci/postgresql:/var/lib/postgresql
+ environment:
+ - POSTGRES_USER=sonar
+ - POSTGRES_PASSWORD=sonar
+ sonar:
+ image: sonarqube:6.7.1
+ restart: always
+ ports:
+ - "19000:9000"
+ - "19092:9092"
+ networks:
+ - prodnetwork
+ depends_on:
+ - sonardb
+ volumes:
+ - /data/docker/ci/sonarqube/conf:/opt/sonarqube/conf
+ - /data/docker/ci/sonarqube/data:/opt/sonarqube/data
+ - /data/docker/ci/sonarqube/extension:/opt/sonarqube/extensions
+ - /data/docker/ci/sonarqube/bundled-plugins:/opt/sonarqube/lib/bundled-plugins
+ environment:
+ - SONARQUBE_JDBC_URL=jdbc:postgresql://sonardb:5432/sonar
+ - SONARQUBE_JDBC_USERNAME=sonar
+ - SONARQUBE_JDBC_PASSWORD=sonar
+ nexus:
+ image: sonatype/nexus3
+ restart: always
+ ports:
+ - "18081:8081"
+ networks:
+ - prodnetwork
+ volumes:
+ - /data/docker/ci/nexus:/nexus-data
+ jenkins:
+ image: wine6823/jenkins:1.1
+ restart: always
+ ports:
+ - "18080:8080"
+ networks:
+ - prodnetwork
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /usr/bin/docker:/usr/bin/docker
+ - /etc/localtime:/etc/localtime:ro
+ - $HOME/.ssh:/root/.ssh
+ - /data/docker/ci/jenkins/lib:/var/lib/jenkins/
+ - /data/docker/ci/jenkins/home:/var/jenkins_home
+ depends_on:
+ - nexus
+ - sonar
+ environment:
+ - NEXUS_PORT=8081
+ - SONAR_PORT=9000
+ - SONAR_DB_PORT=5432
+```
+
+- 启动:`docker-compose up -d`,启动比较慢,等个 2 分钟左右。
+- 浏览器访问 SonarQube:
+ - 默认用户名:admin
+ - 默认密码:admin
+ - 插件安装地址:
+ - 代码检查规范选择:
+ - 如果没有安装相关检查插件,默认是没有内容可以设置,建议现在插件市场安装 FindBugs,这样也可以帮你生成插件目录:`/extension/plugins`
+ - 如果你有其他额外插件,可以把 jar 放在 `${SONAR_HOME}/extension/plugins` 目录下,然后重启下 sonar
+- 浏览器访问 Nexus:
+ - 默认用户名:admin
+ - 默认密码:admin123
+- 浏览器访问 Jenkins:
+ - 首次进入 Jenkins 的 Web UI 界面是一个解锁页面 Unlock Jenkins,需要让你输入:Administrator password
+ - 这个密码放在:`/var/jenkins_home/secrets/initialAdminPassword`,你需要先:`docker exec -it ci_jenkins_1 /bin/bash`
+ - 然后:`cat /var/jenkins_home/secrets/initialAdminPassword`,找到初始化密码
+
+---------------------------------
+
+## 配置 Jenkins 拉取代码权限
+
+- 因为 dockerfile 中我已经把宿主机的 .ssh 下的挂载在 Jenkins 的容器中
+- 所以读取宿主机的 pub:`cat ~/.ssh/id_rsa.pub`,然后配置在 Gitlab 中:
+- Jenkinsfile 中 Git URL 使用:ssh 协议,比如:`ssh://git@192.168.0.105:10022/gitnavi/spring-boot-ci-demo.git`
+
+## Jenkins 特殊配置(减少权限问题,如果是内网的话)
+
+- 访问:
+ - 去掉 `防止跨站点请求伪造`
+ - 勾选 `登录用户可以做任何事` 下面的:`Allow anonymous read access`
+
+
+## 配置 Gitlab Webhook
+
+- Jenkins 访问:
+ - 在 `Build Triggers` 勾选:`触发远程构建 (例如,使用脚本)`,在 `身份验证令牌` 输入框填写任意字符串,这个等下 Gitlab 会用到,假设我这里填写:112233
+- Gitlab 访问:
+ - 在 `URL` 中填写:`http://192.168.0.105:18080/job/任务名/build?token=112233`
+
+
+
+
+## 资料
+
+-
diff --git a/markdown-file/CentOS-7-Install.md b/markdown-file/CentOS-7-Install.md
new file mode 100644
index 00000000..c9428617
--- /dev/null
+++ b/markdown-file/CentOS-7-Install.md
@@ -0,0 +1,70 @@
+# CentOS 7 安装
+
+
+## 概括
+
+- 本教程中主要演示了 VMware Workstation 下安装 `CentOS 7.3` 的过程。
+- VMware 的使用细节可以看这篇:[CentOS 6 安装](CentOS-Install.md)
+- 如果你是要安装到 PC 机中,你需要准备一个 U 盘,以及 Windows 下载这个软件:[USBWriter(提取码:5aa2)](https://pan.baidu.com/s/1gg83h9T)
+- 如果你是要安装到 PC 机中,你需要准备一个 U 盘,以及 macOS 下载这个软件:[balenaEtcher(提取码:oqp9)](https://pan.baidu.com/s/1l5K48tfuCKdn0wR_62PjJA)
+- USBWriter 的使用很简单,如下图即可制作一个 CentOS 系统盘
+
+
+
+
+## VMware 下安装 CentOS 过程
+
+- VMware Workstation 的介绍和下载
+ - 官网:
+ - wiki:
+ - 百度 wiki:
+ - 百度云下载(64 位):
+ - 官网下载:
+
+
+- 安装细节开始:
+
+
+
+
+
+
+
+
+
+
+
+- 如上图,默认是最小安装,点击进去,选择桌面安装。
+- 如上图,默认是自动分区,如果懂得分区,点击进去,进行手动分区,CentOS 7 少了主分区,逻辑分区的选择了。
+
+
+
+- 如上图,root 密码必须设置,我习惯测试的时候是:123456
+- 我没有创建用户,喜欢用 root
+
+
+
+
+
+- 如上图,许可证必须点击进去勾选同意相关协议。
+- 如上图,网络可以稍后在设置,主机名可以现在先填写
+
+
+
+
+
+
+
+
+
+- 如上图右上角,一般我们都选择跳过
+
+
+
+
+
+
+
+
+
+- 到此完成,其他该做啥就做啥
diff --git a/markdown-file/CentOS-Install.md b/markdown-file/CentOS-Install.md
new file mode 100644
index 00000000..94b02c01
--- /dev/null
+++ b/markdown-file/CentOS-Install.md
@@ -0,0 +1,121 @@
+# CentOS 安装
+
+
+## 概括
+
+- 本教程中主要演示了 VirtualBox 和 VMware Workstation 下安装 `CentOS 6.6` 的过程。
+- VirtualBox 是免费开源,我个人在使用经历中遇到过很多次崩溃、安装有问题等,所以它不是我主推的虚拟机
+- VMware Workstation 是商业软件,很好用,一些辅助功能也很到位,主推该虚拟机。
+- 如果你是要安装到 PC 机中,你需要准备一个 U 盘,以及下载这个软件:[USBWriter(提取码:5aa2)](https://pan.baidu.com/s/1gg83h9T)
+- USBWriter 的使用很简单,如下图即可制作一个 CentOS 系统盘
+
+
+
+## VirtualBox 下安装 CentOS 过程
+
+- VirtualBox 的介绍和下载
+- 官网:
+- wiki:
+- 百度 wiki:
+- 百度云下载(32 位和 64 位一体):
+- 官网下载:
+
+
+#### VirtualBox 安装细节开始:
+
+- 
+- 如上图标注 1 所示:点击 `新建` 一个虚拟机。
+- 如上图标注 2 所示:在填写 `名称` 的时候,输入 `CentOS` 相关字眼的时候,下面的版本类型会跟着变化,自动识别为 `Red Hat`
+- 
+- 如上图标注 1 所示:我们装的是 64 位系统,如果你本机内存足够大,建议可以给 2 ~ 4 G 的容量
+- 
+- 
+- 
+- 
+- 如上图所示,命名最好规范,最好要带上系统版本号,硬盘大小建议在 8 ~ 20 G
+- 
+- 如上图 gif 演示,当我们创建好虚拟机之后,需要选择模拟光驱进行系统镜像安装
+- 
+- 
+- 如上图箭头所示,我们这里选择 `Skip`,跳过对镜像的检查,这个一般需要检查很久,而且我们用 iso 文件安装的,一般没这个必要
+- 
+- 
+- 如上图标注 1 所示,建议 Linux 纯新手使用简体中文环境
+- 
+- 
+- 
+- 如上图标注 1 所示,因为我们是用全新的虚拟机,虚拟出来的硬盘都是空的,所以这里可以忽略所有数据
+- 
+- 
+- 
+- 再次强调下,root 账号也就是图上所说的 `根账号`,它是最顶级账号,密码最好别忘记了
+- 
+- 
+- 如上图标注 1 所示,因为我们是用全新的虚拟机,所以这里选择 `使用所有空间` ,然后 CentOS 会按它默认的方式进行分区
+- 
+- 
+- `Desktop` 代表:图形界面版,会默认安装很多软件,建议新手选择此模式,我后面其他文章的讲解都是基于此系统下,如果你不是此模式的系统可能在安装某些软件的时候会出现某些依赖包没有安装的情况
+- `basic sever` 代表:命令行界面,有良好基础的基本都会喜欢这个
+- 
+- 上一步我选择的是 `Desktop` 所以有很多软件需要安装,这个过程大概需要 5 ~ 10 分钟
+- 
+- 安装完成
+- 
+- 安装完成后一定要把盘片删除,防止系统启动的时候去读盘,重新进入安装系统模式
+
+
+## VMware 下安装 CentOS 过程
+
+- VMware Workstation 的介绍和下载
+- 官网:
+- wiki:
+- 百度 wiki:
+- 百度云下载(64 位):
+- 官网下载:
+
+
+#### VMware 安装细节开始:
+
+- 
+- 
+- 默认 VMware 选择的是 `典型` 我不推荐,我下面的步骤是选择 `自定义(高级)`。如果你非常了解 Linux 系统倒是可以考虑选择 `典型`,在它默认安装完的系统上可以很好地按你的需求进行修改
+- 
+- 
+- 牢记:不要在这一步就选择镜像文件,不然也会直接进入 `典型` 模式,直接按它的规则进行系统安装
+- 
+- 
+- 
+- 
+- 
+- 桥接模式:(建议选择此模式)创建一个独立的虚拟主机,在桥接模式下的虚拟主机网络一般要为其配 IP 地址、子网掩码、默认网关(虚拟机ip地址要与主机ip地址处于同网段)
+- NAT 模式:把物理主机作为路由器进行访问互联网,优势:联网简单,劣势:虚拟主机无法与物理主机通讯
+- 主机模式:把虚拟主机网络与真实网络隔开,但是各个虚拟机之间可以互相连接,虚拟机和物理机也可以连接
+- > 上面解释来源:
+- 
+- Buslogic 和 LSIlogic 都是虚拟硬盘 SCSI 设备的类型,旧版本的 OS 默认的是 Buslogic,LSIlogic 类型的硬盘改进了性能,对于小文件的读取速度有提高,支持非 SCSI 硬盘比较好。
+- > 上面解释来源:
+- 
+- 
+- 
+- 强烈建议至少要给 20 G,不然装不了多少软件的
+- 
+- 
+- 
+- 如上图 gif 所示,在创建完虚拟机之后,我们要加载系统镜像,然后启动虚拟机进行安装,接下来的安装步骤跟上面使用 VirtualBox 安装细节基本一样,不一样的地方是我这里选择的是自定义分区,不再是选择默认分区方式
+- 
+- 如上图箭头所示,这里我们选择自定义分区方式
+- 
+- 如上图 gif 所示,我只把最基本的区分出来,如果你有自己的需求可以自己设置
+- 简单分区方案:
+ - `/boot` == 500 M(主分区)
+ - `/swap` == 2 G(逻辑分区)一般大家的说法这个大小是跟你机子的内存大小相关的,也有说法内存大不需要这个,但是还是建议分,虚拟机内存 2 G,所以我分 2 G
+ - `/` == 剩余容量(逻辑分区)剩余的空间都给了根分区
+- 
+- 
+- 
+- 
+- 
+- 
+- 
+- 
+- 
diff --git a/CentOS-Virtual-Machine-Copy-Settings.md b/markdown-file/CentOS-Virtual-Machine-Copy-Settings.md
similarity index 77%
rename from CentOS-Virtual-Machine-Copy-Settings.md
rename to markdown-file/CentOS-Virtual-Machine-Copy-Settings.md
index 43c398ad..3cdbd8f2 100644
--- a/CentOS-Virtual-Machine-Copy-Settings.md
+++ b/markdown-file/CentOS-Virtual-Machine-Copy-Settings.md
@@ -4,12 +4,13 @@
- 在我们需要多台 CentOS 虚拟机的时候,对已有虚拟机的系统进行克隆或是复制。但是这样做又有一个问题,克隆出来的虚拟机启动的时候你输入命令:`ifconfig`,eth0 网卡信息没了,只有一个 eth1。 对于处女座的人来讲这是不允许的。所以我们需要改动下。
- 复制虚拟机后,首次打开该会提示如下内容,一般选择 copy 这个配置。
- - 
+ - 
-## 修改方法
+## CentOS 6 修改方法
+- 设置 hostname:`hostnamectl --static set-hostname linux02`
- 命令:`sudo vim /etc/udev/rules.d/70-persistent-net.rules`
- 该文件中正常此时应该有两行信息
- 在文件中把 NAME="eth0″ 的这一行注释掉
@@ -19,8 +20,14 @@
- 修改 IP 地址
- 把 HWADDR 的值改为上面要求记下来的:00:0c:29:4c:46:01
-- 命令:`nmcli con`
+- 命令:`nmcli con > /opt/info.txt`
- 如果显示两行 UUID 的信息的话,复制不是 System eth0 的那个 UUID 值,下面有用。
- 编辑:`sudo vim /etc/sysconfig/network-scripts/ifcfg-eth0`
- 把文件中的 UUID 值 改为上面要求复制的 UUID 值。
- - 保存配置文件,重启系统,正常应该是可以了。
\ No newline at end of file
+ - 保存配置文件,重启系统,正常应该是可以了。
+
+## CentOS 7 修改方法
+
+- 在 VMware 15 Pro 的情况下,直接 copy 进行后,直接修改网卡配置即可
+- 编辑该文件:`vim /etc/sysconfig/network-scripts/ifcfg-ens33`
+ - 把 ip 地址修改即可
\ No newline at end of file
diff --git a/CentOS.md b/markdown-file/CentOS.md
similarity index 100%
rename from CentOS.md
rename to markdown-file/CentOS.md
diff --git a/markdown-file/CentOS6-and-CentOS7.md b/markdown-file/CentOS6-and-CentOS7.md
new file mode 100644
index 00000000..7dd26640
--- /dev/null
+++ b/markdown-file/CentOS6-and-CentOS7.md
@@ -0,0 +1,81 @@
+# CentOS 6 和 CentOS 7 介绍
+
+## 总体差异
+
+- 
+
+## 想装回过去的一些工具
+
+- 安装:`yum install -y tree net-tools bind-utils tree sysstat vim-en* lrzsz NetworkManager-tui ntp ntpdate iftop tcpdump telnet traceroute`
+
+## 查看版本号/主机名
+
+- `cat /etc/redhat-release`
+- `cat /etc/hostname`
+
+## 常用配置差异
+
+- [CentOS 网络配置](centos-settings/CentOS-Network-Settings.md)
+- [CentOS 图形界面的关闭与开启](centos-settings/Close-XWindow.md)
+
+## systemctl 的用法
+
+- 相当于 CentOS 6 的:service nginx stop
+- `systemctl is-enabled iptables.service` #查询服务是否开机启动
+- `systemctl enable iptables.service` #开机运行服务
+- `systemctl disable iptables.service` #取消开机运行
+- `systemctl start iptables.service` #启动服务
+- `systemctl stop iptables.service` #停止服务
+- `systemctl restart iptables.service` #重启服务
+- `systemctl reload iptables.service` #重新加载服务配置文件
+- `systemctl status iptables.service` #查询服务运行状态
+- `systemctl --failed` #显示启动失败的服务
+- `systemctl list-units --type=service` #查看所有服务
+- `systemctl is-enabled httpd` #查看httpd服务是否开机启动
+- 对于启动脚本的存放位置,也不再是 `/etc/init.d/`(这个目录也是存在的),而是 `/usr/lib/systemd/system/`
+
+### 开放端口
+
+- 一般设置软件端口有一个原则:
+ - 0 ~ 1024 系统保留,一般不要用到
+ - 1024 ~ 65535(2^16) 可以随意用
+- 添加单个端口:`firewall-cmd --zone=public --add-port=8883/tcp --permanent`
+- 添加范围端口:`firewall-cmd --zone=public --add-port=8883-8885/tcp --permanent`
+- 删除端口:`firewall-cmd --zone=public --remove-port=8883/tcp --permanent`
+- 重启防火墙:`firewall-cmd --reload`
+ - 命令解释:
+ - `--zone` #作用域
+ - `--add-port=80/tcp` #添加端口,格式为:端口/通讯协议
+ - `--permanent` #永久生效,没有此参数重启后失效
+- 列出所有端口列表:`firewall-cmd --list-all`
+
+
+## 关闭 firewall 使用 iptables
+
+- 关闭 firewall
+ - `systemctl stop firewalld.service` #停止firewall
+ - `systemctl disable firewalld.service` #禁止firewall开机启动
+- 安装 iptables
+ - `yum install -y iptables-services`
+- 启动 iptables
+ - `systemctl restart iptables.service` #最后重启防火墙使配置生效
+ - `systemctl enable iptables.service` #设置防火墙开机启动
+ - 其他使用照旧
+
+## ifconfig 没有了
+
+- 查看网络配置:`ip a`
+- 装回 ifconfig:`yum install -y net-tools`
+
+## 设置时区
+
+- `timedatectl set-timezone Asia/Shanghai`
+- `timedatectl status`
+
+
+## 资料
+
+-
+-
+-
+-
diff --git a/markdown-file/Confluence-Install-And-Settings.md b/markdown-file/Confluence-Install-And-Settings.md
new file mode 100644
index 00000000..5a1a6fe1
--- /dev/null
+++ b/markdown-file/Confluence-Install-And-Settings.md
@@ -0,0 +1,134 @@
+# Confluence 安装和配置
+
+## Confluence 6.15.4
+
+- 最新 6.15.4 版本时间:2019-05
+
+#### 数据库
+
+```
+docker run \
+ --name mysql-confluence \
+ --restart always \
+ -p 3316:3306 \
+ -e MYSQL_ROOT_PASSWORD=adg123456 \
+ -e MYSQL_DATABASE=confluence_db \
+ -e MYSQL_USER=confluence_user \
+ -e MYSQL_PASSWORD=confluence_123456 \
+ -d \
+ mysql:5.7
+```
+
+- 连上容器:`docker exec -it mysql-confluence /bin/bash`
+ - 连上 MySQL:`mysql -u root -p`
+- 设置编码:
+ - **必须做这一步,不然配置过程会报错,confluence 的 DB 要求是 utf8,还不能是 utf8mb4**
+ - **并且排序规则还必须是:utf8_bin**
+ - **数据库必须使用'READ-COMMITTED'作为默认隔离级别**
+
+```
+SET NAMES 'utf8';
+alter database confluence_db character set utf8 collate utf8_bin;
+SET GLOBAL tx_isolation='READ-COMMITTED';
+```
+
+#### 安装
+
+- 下载:
+ - 选择:linux64 类型下载
+- 授权:`chmod +x atlassian-confluence-6.15.4-x64.bin`
+
+
+```
+./atlassian-confluence-6.15.4-x64.bin
+
+开始提示:
+
+Unpacking JRE ...
+Starting Installer ...
+
+This will install Confluence 6.9.0 on your computer.
+OK [o, Enter], Cancel [c]
+
+>> 输入o或直接回车
+
+Click Next to continue, or Cancel to exit Setup.
+
+Choose the appropriate installation or upgrade option.
+Please choose one of the following:
+Express Install (uses default settings) [1],
+Custom Install (recommended for advanced users) [2, Enter],
+Upgrade an existing Confluence installation [3]
+1
+>> 这里输入数字1
+
+See where Confluence will be installed and the settings that will be used.
+Installation Directory: /opt/atlassian/confluence
+Home Directory: /var/atlassian/application-data/confluence
+HTTP Port: 8090
+RMI Port: 8000
+Install as service: Yes
+Install [i, Enter], Exit [e]
+i
+
+>> 输入i或者直接回车
+
+Extracting files ...
+
+Please wait a few moments while we configure Confluence.
+
+Installation of Confluence 6.9.0 is complete
+Start Confluence now?
+Yes [y, Enter], No [n]
+
+>> 输入y或者直接回车
+
+Please wait a few moments while Confluence starts up.
+Launching Confluence ...
+
+Installation of Confluence 6.9.0 is complete
+Your installation of Confluence 6.9.0 is now ready and can be accessed via
+your browser.
+Confluence 6.9.0 can be accessed at http://localhost:8090
+Finishing installation ...
+
+# 安装完成,访问本机的8090端口进行web端安装
+# 开放防火墙端口
+firewall-cmd --add-port=8090/tcp --permanent
+firewall-cmd --add-port=8000/tcp --permanent
+firewall-cmd --reload
+```
+
+- 默认是安装在 /opt 目录下:`/opt/atlassian/confluence/confluence/WEB-INF/lib`
+- 启动:`sh /opt/atlassian/confluence/bin/start-confluence.sh`
+- 停止:`sh /opt/atlassian/confluence/bin/stop-confluence.sh`
+- 查看 log:`tail -300f /opt/atlassian/confluence/logs/catalina.out`
+- 卸载:`sh /opt/atlassian/confluence/uninstall`
+- 设置 MySQL 连接驱动,把 mysql-connector-java-5.1.47.jar 放在目录 `/opt/atlassian/confluence/confluence/WEB-INF/lib`
+
+#### 首次配置
+
+- 访问:
+- 参考文章:
+- 参考文章:
+- 因为步骤一样,所以我就不再截图了。
+
+#### License 过程
+
+- 参考自己的为知笔记
+
+
+## 反向代理的配置可以参考
+
+-
+
+
+## 使用 markdown
+
+- 点击右上角小齿轮 > 管理应用 > 搜索市场应用 > 输入 markdown > 安装
+
+
+## 其他资料
+
+-
+-
diff --git a/markdown-file/Crontab.md b/markdown-file/Crontab.md
new file mode 100644
index 00000000..2bb88205
--- /dev/null
+++ b/markdown-file/Crontab.md
@@ -0,0 +1,62 @@
+# Crontab 介绍
+
+
+## Crontab 安装
+
+- 查看是否已安装:
+ - CentOS:`rpm -qa | grep cron`
+ - Ubuntu:`dpkg -l | grep cron`
+
+- 安装(一般系统是集成的):
+ - CentOS 6 / 7:`sudo yum install -y vixie-cron crontabs`
+ - Ubuntu:`sudo apt-get install -y cron`
+
+- 服务常用命令
+ - CentOS 6
+ - `service crond start` 启动服务
+ - `service crond stop` 关闭服务
+ - `service crond restart` 重启服务
+ - CentOS 7
+ - `systemctl start crond` 启动服务
+ - `systemctl restart crond` 重新启动服务
+ - `systemctl status crond` 加入自启动
+ - `systemctl stop crond` 关闭服务
+
+
+## Crontab 服务器配置文件常用参数
+
+- 配置文件介绍(记得先备份):`sudo vim /etc/crontab`
+- 注意:不要在配置文件里面写相对路径
+ - 该配置格式解释:
+ - 
+ - 常用例子介绍:
+ - `30 21 * * * service httpd restart` #每晚的 21:30 重启 apache
+ - `30 21 * * 6,0 service httpd restart` #每周六、周日的 21:30 重启 apache
+ - `45 4 1,10,22 * * service httpd restart` #每月的 1、10、22 日的 4:45 重启 apache
+ - `45 4 1-10 * * service httpd restart` #每月的 1 到 10 日的 4:45 重启 apache
+ - `*/2 * * * * service httpd restart` #每隔两分钟重启 apache
+ - `1-59/2 * * * * service httpd restart` #每隔两分钟重启 apache(这个比较特殊:1-59/2 这个表示过掉0分,从 1 分开始算,每隔两分执行,所以 1 分执行了,3 分执行了,5 分执行了....都是奇数进行执行。默认的 */2 都是偶数执行。)
+ - `* */2 * * * service httpd restart` #每隔两小时重启 apache
+ - `0 23-7/2 * * * service httpd restart` #晚上 11 点到早上 7 点之间,每隔 2 个小时重启 apache
+ - `0-59/30 18-23 * * * service httpd restart` #每天 18:00 到 23:00 之间,每隔 30 分钟重启 apache(方法一)
+ - `0,30 18-23 * * * service httpd restart` #每天 18:00 到 23:00 之间,每隔 30 分钟重启 apache(方法二)
+ - `0 4 * * sun root /opt/shell/crontab-redis-restart.sh` #每周日 4:00 执行一个脚本(root 用户运行,有些脚本不指定用户会报:ERROR (getpwnam() failed)
+- 更多例子可以看:
+- 执行记录日志:`tail -f /var/log/cron`(如果发现任务不执行,可以来这里盯着日志看)
+
+
+## Crontab 权限问题
+
+- 一般默认只有 root 用户可以使用
+- 如果要指定某个用户可以使用,可以在 /etc/cron.allow 添加(不存在文件就创建一个)
+- 如果要指定某个用户不可以使用,可以在 /etc/cron.deny 添加(不存在文件就创建一个)
+- 如果一个用户同时在两个文件都存在,那则以 allow 为准
+
+## Crontab 不执行
+
+- Crontab 不执行原因有很多,可以 Google 搜索:`Crontab 不执行`,这里不多说。
+
+## Crontab 资料
+
+-
+-
diff --git a/markdown-file/Daemontools.md b/markdown-file/Daemontools.md
new file mode 100644
index 00000000..130ef7dc
--- /dev/null
+++ b/markdown-file/Daemontools.md
@@ -0,0 +1,197 @@
+# daemontools 工具
+
+## supervisord
+
+- 注意:Supervisor 能管理非 daemon 的进程,也就是说 Supervisor 不能管理守护进程。否则提示 Exited too quickly (process log may have details) 异常。
+- Supervisor 不支持 python 3,安装 python 2 方法:
+- 官网:
+- 安装过程:
+ - 解释:easy_install 是 setuptools 包里带的一个命令,使用 easy_install 实际上是在调用 setuptools 来完成安装模块的工作,所以安装 setuptools 即可。
+
+- 安装方案:
+
+```
+#第一种(推荐)
+yum install python-setuptools
+easy_install supervisor
+
+#第二种
+yum install python-setuptools
+easy_install pip
+pip install supervisor
+
+#第三种
+yum install -y epel-release
+yum install -y supervisor
+```
+
+- 如果以上还不能安装,或是安装过程出现各种问题,或是安装完成后使用出现问题,应该就是环境有问题。至少我在京东云上发现会有这个问题。环境是 centos 6.8,python 2.6.6
+- 如果你遇到这种问题需要源码安装。
+- 源码和各个依赖的源码下载地址(密码:j797):
+
+```
+tar zxvf setuptools-36.6.0.tar.gz
+cd setuptools-36.6.0
+python bootstrap.py install
+python setup.py install
+
+tar zxvf meld3.tar.gz
+cd meld3
+python setup.py install
+
+tar zxvf elementtree-1.2.6-20050316.tar.gz
+cd elementtree-1.2.6-20050316
+python setup.py install
+
+tar zxvf supervisor-3.3.3.tar.gz
+cd supervisor-3.3.3
+python setup.py install
+```
+
+
+- 生成配置文件:`echo_supervisord_conf > /etc/supervisord.conf`
+- 创建专门的程序配置文件目录、日志目录:
+ - `mkdir -p /var/log/supervisor`
+ - `mkdir -p /etc/supervisor/conf.d/`
+ - `echo -e "[include]\nfiles = /etc/supervisor/conf.d/*.conf">>/etc/supervisord.conf`
+- 安装完成的内容介绍:supervisor 安装完成后会生成三个执行程序:
+ - supervisortd:supervisor 的守护进程服务(用于接收进程管理命令)
+ - supervisorctl:客户端(用于和守护进程通信,发送管理进程的指令)
+ - echo_supervisord_conf:生成初始配置文件程序。
+- 程序位置:`/usr/bin/supervisord`
+- 配置文件位置:`/etc/supervisord.conf`
+
+### Logstash 进程进行守护
+
+- 默认安装完 Supervisor 是已经启动的,所以在加入新配置之前,需要先停止程序:`ps -ef | grep supervisord`,kill 对应的 pid
+- 创建配置文件:`vim /etc/supervisor/conf.d/logstash.conf`
+
+``` nginx
+[program:gitnavi-logstash]
+command=/usr/program/elk/logstash-2.4.1/bin/logstash -f /usr/program/elk/logstash-2.4.1/config/logstash.conf
+stdout_logfile=/var/log/supervisor/supervisord-logstash.log
+stderr_logfile=/var/log/supervisor/supervisord-logstash-err.log
+user=root
+autostart=true
+autorestart=false
+startsecs=5
+priority=1
+stopasgroup=true
+killasgroup=true
+```
+
+- 该配置的具体说明可以参考:[使用 supervisor 管理进程](http://liyangliang.me/posts/2015/06/using-supervisor/)
+- 启动程序(默认会启动所有子任务):`/usr/bin/supervisord -c /etc/supervisord.conf`
+- 管理子任务的命令:
+ - 子任务状态:`/usr/bin/supervisorctl status`
+ - 启动所有子任务:`/usr/bin/supervisorctl start all`
+ - 结束所有子任务:`/usr/bin/supervisorctl stop all`
+ - 启动指定子任务:`/usr/bin/supervisorctl start gitnavi-logstash`
+ - 结束指定子任务:`/usr/bin/supervisorctl stop gitnavi-logstash`
+ - 重启指定子任务:`/usr/bin/supervisorctl restart gitnavi-logstash`
+ - 只载入最新的配置文件, 并不重启任何进程:`/usr/bin/supervisorctl reread`
+ - 载入最新的配置文件,停止原来的所有进程并按新的配置启动管理所有进程:`/usr/bin/supervisorctl reload`
+ - 根据最新的配置文件,启动新配置或有改动的进程,配置没有改动的进程不会受影响而重启:`/usr/bin/supervisorctl update`
+ - 查看所有子任务状态,如果没有运行的子任务则是没有任何反馈信息:`/usr/bin/supervisorctl status`
+- 管理所有子任务也可以用交互方式,输入命令:`supervisorctl`,会进入 supervisord 的交互模式下,如果当前有启动的任务,还可以看到对应的任务情况。
+ - 在该交互下可以停止指定名称的子任务,比如 logstash 任务:`stop gitnavi-logstash`
+ - 也可以停止所有子任务:`stop all`
+ - 也可以启动所有子任务:`start all`
+ - 更多命令可以输入:`help`
+
+### 设置 supervisord 开启自启动
+
+#### CentOS 6
+
+- 创建文件:`vim /etc/init.d/supervisord`
+
+``` nginx
+#!/bin/sh
+#
+# Supervisor is a client/server system that
+# allows its users to monitor and control a
+# number of processes on UNIX-like operating
+# systems.
+#
+# chkconfig: - 64 36
+# description: Supervisor Server
+# processname: supervisord
+# Source init functions
+. /etc/init.d/functions
+RETVAL=0
+prog="supervisord"
+pidfile="/tmp/supervisord.pid"
+lockfile="/var/lock/subsys/supervisord"
+start()
+{
+echo -n $"Starting $prog: "
+daemon --pidfile $pidfile supervisord -c /etc/supervisord.conf
+RETVAL=$?
+echo
+[ $RETVAL -eq 0 ] && touch ${lockfile}
+}
+stop()
+{
+echo -n $"Shutting down $prog: "
+killproc -p ${pidfile} /usr/bin/supervisord
+RETVAL=$?
+echo
+if [ $RETVAL -eq 0 ] ; then
+rm -f ${lockfile} ${pidfile}
+fi
+}
+case "$1" in
+start)
+start ;;
+stop) stop ;;
+status)
+status $prog ;;
+restart)
+stop
+start ;;
+*)
+echo "Usage: $0 {start|stop|restart|status}" ;;
+esac
+```
+
+
+- `chmod 755 /etc/init.d/supervisord`
+- `chkconfig supervisord on`
+- 以后启动可以用:`service supervisord start`
+- 以后停止可以用:`service supervisord stop`
+
+
+#### CentOS 7
+
+- 创建文件:`vim /lib/systemd/system/supervisor.service`
+
+``` ini
+[Unit]
+Description=supervisor
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
+ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown
+ExecReload=/usr/bin/supervisorctl $OPTIONS reload
+KillMode=process
+Restart=on-failure
+RestartSec=42s
+
+[Install]
+WantedBy=multi-user.target
+```
+
+- `chmod 766 /lib/systemd/system/supervisor.service`
+- `systemctl enable supervisor.service`
+- `systemctl daemon-reload`
+
+## 资料
+
+-
+-
+-
+-
+-
+-
diff --git a/markdown-file/Docker-Install-And-Usage.md b/markdown-file/Docker-Install-And-Usage.md
new file mode 100644
index 00000000..734c11de
--- /dev/null
+++ b/markdown-file/Docker-Install-And-Usage.md
@@ -0,0 +1,839 @@
+
+
+# Docker 使用
+
+## 环境说明
+
+- CentOS 7.3(不准确地说:要求必须是 CentOS 7 64位)
+- 不建议在 Windows 上使用
+
+## Docker 基本概念
+
+- 官网:
+- 宿主机:安装 Docker 的那台电脑
+- Docker:一个虚拟化软件,你可以认为是类似:VMware、Virtualbox
+- 镜像:可以认为是类似 Windows 下的:XXXX.iso
+- 容器:容器为镜像的实例,可以认为是 Virtualbox 运行 XXXX.iso 后的效果
+- 官网的镜像仓库地址:
+- 对开发来讲总结一个最简单的说法:在 Maven 未产生的年代,jar 包要随着开发项目走到哪里跟到哪里。有了 Maven 写好 pom.xml 即可。此时的 Docker 就好比如 Maven,帮你省去了开发过程中的部署环境差异,你再也不能随便说:你的系统可以运行,我的系统就不行。现在别人连系统都帮你做好了。
+- 玩法理念:单进程,一个容器最好最专注去做一个事情。虽然它可以既装 MySQL,又装 Nginx 等等,但是让一个容器只做好一件事是最合适的。
+- 其他通俗解释:
+
+> Docker的思想来自于集装箱,集装箱解决了什么问题?在一艘大船上,可以把货物规整的摆放起来。并且各种各样的货物被集装箱标准化了,集装箱和集装箱之间不会互相影响。那么我就不需要专门运送水果的船和专门运送化学品的船了。只要这些货物在集装箱里封装的好好的,那我就可以用一艘大船把他们都运走。
+ docker就是类似的理念。现在都流行云计算了,云计算就好比大货轮。docker就是集装箱。
+ 1.不同的应用程序可能会有不同的应用环境,比如.net开发的网站和php开发的网站依赖的软件就不一样,如果把他们依赖的软件都安装在一个服务器上就要调试很久,而且很麻烦,还会造成一些冲突。比如IIS和Apache访问端口冲突。这个时候你就要隔离.net开发的网站和php开发的网站。常规来讲,我们可以在服务器上创建不同的虚拟机在不同的虚拟机上放置不同的应用,但是虚拟机开销比较高。docker可以实现虚拟机隔离应用环境的功能,并且开销比虚拟机小,小就意味着省钱了。
+ 2.你开发软件的时候用的是Ubuntu,但是运维管理的都是centos,运维在把你的软件从开发环境转移到生产环境的时候就会遇到一些Ubuntu转centos的问题,比如:有个特殊版本的数据库,只有Ubuntu支持,centos不支持,在转移的过程当中运维就得想办法解决这样的问题。这时候要是有docker你就可以把开发环境直接封装转移给运维,运维直接部署你给他的docker就可以了。而且部署速度快。
+ 3.在服务器负载方面,如果你单独开一个虚拟机,那么虚拟机会占用空闲内存的,docker部署的话,这些内存就会利用起来。
+ 总之docker就是集装箱原理。
+
+- Docker 的优点:
+- 持续部署与测试
+
+> Docker在开发与运维的世界中具有极大的吸引力,因为它能保持跨环境的一致性。在开发与发布的生命周期中,不同的环境具有细微的不同,这些差异可能是由于不同安装包的版本和依赖关系引起的。然而,Docker可以通过确保从开发到产品发布整个过程环境的一致性来解决这个问题。
+ Docker容器通过相关配置,保持容器内部所有的配置和依赖关系始终不变。最终,你可以在开发到产品发布的整个过程中使用相同的容器来确保没有任何差异或者人工干预。
+ 使用Docker,你还可以确保开发者不需要配置完全相同的产品环境,他们可以在他们自己的系统上通过VirtualBox建立虚拟机来运行Docker容器。Docker的魅力在于它同样可以让你在亚马逊EC2实例上运行相同的容器。如果你需要在一个产品发布周期中完成一次升级,你可以很容易地将需要变更的东西放到Docker容器中,测试它们,并且使你已经存在的容器执行相同的变更。这种灵活性就是使用Docker的一个主要好处。和标准部署与集成过程一样,Docker可以让你构建、测试和发布镜像,这个镜像可以跨多个服务器进行部署。哪怕安装一个新的安全补丁,整个过程也是一样的。你可以安装补丁,然后测试它,并且将这个补丁发布到产品中。
+
+- 环境标准化和版本控制
+
+> Docker容器可以在不同的开发与产品发布生命周期中确保一致性,进而标准化你的环境。除此之外,Docker容器还可以像git仓库一样,可以让你提交变更到Docker镜像中并通过不同的版本来管理它们。设想如果你因为完成了一个组件的升级而导致你整个环境都损坏了,Docker可以让你轻松地回滚到这个镜像的前一个版本。这整个过程可以在几分钟内完成,如果和虚拟机的备份或者镜像创建流程对比,那Docker算相当快的,它可以让你快速地进行复制和实现冗余。此外,启动Docker就和运行一个进程一样快。
+
+- 隔离性
+
+> Docker可以确保你的应用程序与资源是分隔开的。几个月前,Gartner发表了一篇报告,这份报告说明了运行Docker 容器进行资源隔离的效果和虚拟机(VM)管理程序一样的好,但是管理与控制方面还需要进行完善。我们考虑这样一个场景,你在你的虚拟机中运行了很多应用程序,这些应用程序包括团队协作软件(例如Confluence)、问题追踪软件(例如JIRA)、集中身份管理系统(例如Crowd)等等。由于这些软件运行在不同的端口上,所以你必须使用Apache或者Nginx来做反向代理。到目前为止,一切都很正常,但是随着你的环境向前推进,你需要在你现有的环境中配置一个内容管理系统(例如Alfresco)。这时候有个问题发生了,这个软件需要一个不同版本的Apache Tomcat,为了满足这个需求,你只能将你现有的软件迁移到另一个版本的Tomcat上,或者找到适合你现有Tomcat的内容管理系统(Alfresco)版本。对于上述场景,使用Docker就不用做这些事情了。Docker能够确保每个容器都拥有自己的资源,并且和其他容器是隔离的。你可以用不同的容器来运行使用不同堆栈的应用程序。除此之外,如果你想在服务器上直接删除一些应用程序是比较困难的,因为这样可能引发依赖关系冲突。而Docker可以帮你确保应用程序被完全清除,因为不同的应用程序运行在不同的容器上,如果你不在需要一款应用程序,那你可以简单地通过删除容器来删除这个应用程序,并且在你的宿主机操作系统上不会留下任何的临时文件或者配置文件。除了上述好处,Docker还能确保每个应用程序只使用分配给它的资源(包括CPU、内存和磁盘空间)。一个特殊的软件将不会使用你全部的可用资源,要不然这将导致性能降低,甚至让其他应用程序完全停止工作。
+
+- 安全性
+
+> 如上所述,Gartner也承认Docker正在快速地发展。从安全角度来看,Docker确保运行在容器中的应用程序和其他容器中的应用程序是完全分隔与隔离的,在通信流量和管理上赋予你完全的控制权。Docker容器不能窥视运行在其他容器中的进程。从体系结构角度来看,每个容器只使用着自己的资源(从进程到网络堆栈)。作为紧固安全的一种手段,Docker将宿主机操作系统上的敏感挂载点(例如/proc和/sys)作为只读挂载点,并且使用一种写时复制系统来确保容器不能读取其他容器的数据。Docker也限制了宿主机操作系统上的一些系统调用,并且和SELinux与AppArmor一起运行的很好。此外,在Docker Hub上可以使用的Docker镜像都通过数字签名来确保其可靠性。由于Docker容器是隔离的,并且资源是受限制的,所以即使你其中一个应用程序被黑,也不会影响运行在其它Docker容器上的应用程序。
+
+- 多云平台
+
+> Docker最大的好处之一就是可移植性。在过去的几年里,所有主流的云计算提供商,包括亚马逊AWS和谷歌的GCP,都将Docker融入到他们的平台并增加了各自的支持。Docker容器能运行在亚马逊的EC2实例、谷歌的GCP实例、Rackspace服务器或者VirtualBox这些提供主机操作系统的平台上。举例来说,如果运行在亚马逊EC2实例上的Docker容器能够很容易地移植到其他几个平台上,比如说VirtualBox,并且达到类似的一致性和功能性,那这将允许你从基础设施层中抽象出来。除了AWS和GCP,Docker在其他不同的IaaS提供商也运行的非常好,例如微软的Azure、OpenStack和可以被具有不同配置的管理者所使用的Chef、Puppet、Ansible等。
+
+
+## Docker 安装和基本配置
+
+- 主要有两个版本:
+
+> **Docker Enterprise Edition (Docker EE)** is designed for enterprise development and IT teams who build, ship, and run business critical applications in production at scale. Docker EE is integrated, certified, and supported to provide enterprises with the most secure container platform in the industry to modernize all applications. For more information about Docker EE, including purchasing options, see Docker Enterprise Edition.
+**Docker Community Edition (Docker CE)** is ideal for developers and small teams looking to get started with Docker and experimenting with container-based apps. Docker CE is available on many platforms, from desktop to cloud to server. Docker CE is available for macOS and Windows and provides a native experience to help you focus on learning Docker. You can build and share containers and automate the development pipeline all from a single environment.
+Docker CE has both stable and edge channels.
+ Stable builds are released once per quarter and are supported for 4 months.
+ Edge builds are released once per month, and are supported for that month only. If you subscribe to the Edge channel on Linux distributions, you should also subscribe to the Stable channel.
+
+
+- 官网总的安装手册:
+- 官网 CentOS 安装手册:
+- 目前也支持 Windows,特别是 Windows 10,直接官网一个安装包即可搞定。
+- Windows 10 的 Docker 安装说明:
+- 我这里选择 Docker CE 版本:
+- CentOS 安装过程:
+ - `sudo yum install -y yum-utils device-mapper-persistent-data lvm2`
+ - 添加 repo(可能网络会很慢,有时候会报:Timeout,所以要多试几次)
+ - `sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo`
+ - `sudo yum makecache fast`
+ - `sudo yum install -y docker-ce`,大小:19M,速度很慢。
+- 查看配置文件位置:`systemctl show --property=FragmentPath docker`
+- 启动 Docker:`systemctl start docker.service`
+- 停止 Docker:`systemctl stop docker.service`
+- 查看状态:`systemctl status docker.service`
+- 运行 hello world 镜像:`sudo docker run hello-world`
+ - 因为是第一次使用,所以没这个镜像,需要一个下载过程,所以需要几分钟,可能还会报:Timeout。
+ - 镜像自动下载好后会输出这样一段内容,表示已经正常安装并可用了:
+
+ ``` bash
+ Unable to find image 'hello-world:latest' locally
+ latest: Pulling from library/hello-world
+ 78445dd45222: Pull complete
+ Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
+ Status: Downloaded newer image for hello-world:latest
+
+ Hello from Docker!
+ This message shows that your installation appears to be working correctly.
+
+ To generate this message, Docker took the following steps:
+ 1. The Docker client contacted the Docker daemon.
+ 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
+ 3. The Docker daemon created a new container from that image which runs the
+ executable that produces the output you are currently reading.
+ 4. The Docker daemon streamed that output to the Docker client, which sent it
+ to your terminal.
+
+ To try something more ambitious, you can run an Ubuntu container with:
+ $ docker run -it ubuntu bash
+
+ Share images, automate workflows, and more with a free Docker ID:
+ https://cloud.docker.com/
+
+ For more examples and ideas, visit:
+ https://docs.docker.com/engine/userguide/
+ ```
+
+
+## 镜像加速
+
+- 只要是外国的东西在国内基本都很难有好的速度,所有就有了加速器的概念,目前国内常用的如下:
+- 阿里云:
+- USTC:
+- daocloud:
+- 网易:
+- 时速云:
+- 灵雀云:
+- 推荐优先阿里云,然后是 USTC
+- 我下面的讲解也是基于阿里云加速
+- 阿里云的服务需要注册账号,**首次使用需要设置 docker 登录密码(阿里云叫做:**修改Registry登录密码**),这个以后用私人仓库会用到。**
+ - 如果忘记了,后面可以在这里修改:
+ - 注册后请访问:,你会看到专属的加速地址,比如我是:`https://ldhc17y9.mirror.aliyuncs.com`,所以下面文章你看到该地址都表示是这个专属地址,请记得自己更换自己的。
+ - 以及教你如何使用 Docker 加速器。如果你已经安装了最新版的 Docker 你就不需要用它的脚本进行安装了。
+- 最新版本的 Docker 是新增配置文件:`vim /etc/docker/daemon.json`,增加如下内容:
+
+``` bash
+{
+ "registry-mirrors": ["https://ldhc17y9.mirror.aliyuncs.com"]
+}
+```
+
+- `sudo systemctl daemon-reload`
+- `sudo systemctl restart docker`
+- 在以后的生活中如果要经常使用阿里云做为自己仓库,那你还需要做:
+ - 在 ` namespace管理` 中创建属于你自己的 namespace:
+ - 创建镜像仓库:
+ - 创建好仓库后,点击:`管理` 进入查看仓库的更多详细信息,这里面有很多有用的信息,包括一个详细的操作指南,**这份指南等下会用到。**
+ - 比如我自己创建一个 redis-to-cluster 仓库,地址是阿里云给我们的:`registry.cn-shenzhen.aliyuncs.com/youmeek/redis-to-cluster`
+ - 那我登录这个镜像地址的方式:
+
+```
+docker login registry.cn-shenzhen.aliyuncs.com
+会让我输入
+Username:阿里云邮箱
+password:上文提到的--Registry登录密码
+```
+
+- 然后在我的仓库管理地址有教我如何推送和拉取镜像:
+- 拉取:`docker pull registry.cn-shenzhen.aliyuncs.com/youmeek/redis-to-cluster:[镜像版本号]`
+- 推送:
+
+```
+docker login
+
+docker tag [ImageId] registry.cn-shenzhen.aliyuncs.com/youmeek/redis-to-cluster:[镜像版本号]
+
+docker push registry.cn-shenzhen.aliyuncs.com/youmeek/redis-to-cluster:[镜像版本号]
+```
+
+# Docker 命令,最终部署 Spring Boot 项目
+
+- 建议:初期使用的时候尽量用容器 ID / 镜像 ID。如果使用 Tag/Name 在东西多的情况下很容易混乱 还不如就用记不住但是肯定唯一的容器 ID / 镜像 ID
+
+## 重要的基本概念
+
+- 可以代表一个完整的镜像名有两种方式:
+ - REPOSITORY(仓库):TAG(标签)
+ - 其中 TAG 表面上不是必须有的,本质是 docker 帮你用 latest 来代替了。latest 这里最好翻译为默认,而不是最新。
+ - IMAGE ID(镜像ID)
+ - 这是一个 Docker 随机给你生成 数字+字母 的字符串
+
+## 部署一个 Spring Boot 的 Java Web 项目为例
+
+- 宿主机环境说明:
+ - IP 地址:`http://192.168.137.128`
+ - 停止了防火墙:`systemctl stop firewalld.service ; systemctl stop iptables.service`
+ - 停止防火墙后重启 Docker 服务:`systemctl restart docker.service`
+ - JDK(jdk-8u121-linux-x64.tar.gz)、jar 应用(spring-boot-my-demo.jar),存放宿主机位置:`/opt/setups`
+ - Spring Boot 的 jar 应用中配置文件给的端口是:8080,常规情况下的访问路径:`http://127.0.0.1:8080/youmeek`
+- 下载镜像:`docker pull centos:6.8`,我的 IMAGE_ID 为:`0cd976dc0a98`
+- 运行镜像,实例化为一个容器:`docker run -i -t -v /opt/setups:/opt 0cd976dc0a98 /bin/bash`
+ - `-v:表示需要将本地宿主机的目录挂载到容器中对应的一个目录上,格式:-v <宿主机目录>:<容器目录>,所以此时对容器此目录的操作,也是等同于对宿主机的目录的操作`
+- 在容器里安装 Oracle JDK 8、配置 JDK 环境变量这里不多说,具体看:[JDK 安装](https://github.com/judasn/Linux-Tutorial/blob/master/JDK-Install.md)。
+- 把容器中 /opt 目录下的 spring-boot-my-demo.jar 拷贝到容器的 root 目录下:`cp /opt/spring-boot-my-demo.jar /root`
+- 再容器里新建脚本:`vi /root/spring-boot-run.sh`,脚本内容如下:
+
+``` bash
+#!/bin/bash
+source /etc/profile
+java -jar /root/spring-boot-my-demo.jar
+```
+
+- 在容器中对新建脚本增加执行权限:`chmod u+x /root/spring-boot-run.sh`
+- 我们启动另外一个终端
+- 查看我们刚刚运行的容器相关信息:`docker ps -a`
+ - 我们看到了我们刚刚运行的容器 ID(CONTAINER ID)为:`a5d544d9b6f9`,这个下面要用到
+- 基于刚刚运行的容器创建新镜像:`docker commit a5d544d9b6f9 youmeek/springboot:0.1`
+ - 查看现在的镜像库:`docker images`,会发现多了一个 youmeek/springboot 新镜像,镜像 ID 为:`7024f230fef9`
+- 运行新镜像,实例化为一个容器,并启动容器中刚刚写的脚本:`docker run -d -p 38080:8080 --name=springBootJar --hostname=springBootJar 7024f230fef9 /root/spring-boot-run.sh`
+ - `-d`:表示以“守护模式”执行 spring-boot-run.sh 脚本,此时 jar 中的 log 日志不会出现在输出终端上。
+ - `-p`:表示宿主机与容器的端口映射,此时将容器内部的 8080 端口映射为宿主机的 38080 端口,这样就向外界暴露了 38080 端口,可通过 Docker 网桥来访问容器内部的 8080 端口了。
+ - `--name`:表示给新实例容器取的名称,用一个有意义的名称命名即可
+- 查看其实运行的容器:`docker ps -a`,可以知道我们的新容器 ID:`fd21ac056343`,名称为:`springBootJar`
+- 查看这个容器的 jar 应用的 log 输出:`docker logs -f fd21ac056343`,可以看到 jar 启动后的 log 输出内容
+- 通过浏览器访问容器中的应用:`http://192.168.137.128:38080/youmeek/`,可以看到 jar 应用的首页可以访问
+
+## Docker 基本命令
+
+- 官网文档:
+
+
+#### 版本信息
+
+- `docker version`,查看docker版本
+- `docker info`,显示docker系统的信息
+
+#### 镜像仓库
+
+- `docker pull`:从仓库下载镜像到本地
+ - `docker pull centos:latest`:获取 CentOS 默认版本镜像
+ - `docker pull centos:7.3.1611`:获取 CentOS 7 镜像,下载大小 70M 左右,下面的操作基于此镜像
+ - `docker pull centos:6.8`:获取 CentOS 6 镜像
+ - `docker pull registry.cn-hangzhou.aliyuncs.com/chainone/centos7-jdk8`:获取别人做好的阿里云镜像
+- `docker push`:将一个镜像 push 到 registry 仓库中
+ - `docker push myapache:v1`
+- `docker search`:从 registry 仓库搜索镜像
+ - `docker search -s 3 centos`,参数 `-s 数字`:表示筛选出收藏数(stars值)大于等于 3 的镜像
+- `docker login`:登录到一个镜像仓库。默认登录的是官网的仓库:
+ - 登录阿里云仓库格式:`sudo docker login --username=阿里云邮箱`
+ - 比如我是这个:`docker login --username=23333212@qq.com registry.cn-shenzhen.aliyuncs.com`,你完整的登录地址你需要访问:,在你自己创建的仓库中去查看那份详细操作指南上的地址
+ - 密码就是你首次访问:,弹窗出来让你设置的那个密码,如果忘记了重新设置下即可,重设地址:,右上角有一个:修改docker登录密码。
+
+#### 本地镜像管理
+
+- `docker stats`:查看当前启动的容器各自占用的系统资源
+ - `bin docker stats --no-stream kafkadocker_kafka_1 kafkadocker_zookeeper_1`:查看指定容器的占用资源情况
+ - 更加高级的监控方式有一个软件叫做:ctop(推荐使用):
+
+```
+CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
+4532a9ee27b8 cloud-cadvisor 1.49% 53.28MiB / 3.702GiB 1.41% 13.5MB / 646MB 265MB / 0B 19
+3895d5d50a5e kafkadocker_kafka_1 1.45% 1.24GiB / 3.702GiB 33.51% 145MB / 186MB 499MB / 724MB 128
+1d1a6a7c48d8 kafkadocker_zookeeper_1 0.11% 70.85MiB / 3.702GiB 1.87% 55.8MB / 33.7MB 209MB / 1.22MB 23
+```
+
+- `docker images`:显示本地所有的镜像列表
+ - 关注 REPOSITORY(名称),TAG(标签),IMAGE ID(镜像ID)三列
+- `docker images centos`:查看具体镜像情况
+- `docker rmi`:删除镜像,一般删除镜像前要先删除容器,不然如果镜像有被容器调用会报错
+ - `docker rmi 容器ID`:删除具体某一个镜像
+ - `docker rmi 仓库:Tag`:删除具体某一个镜像
+ - `docker rmi $(docker images -q)`,删除所有镜像
+ - `docker rmi -f $(docker images -q)`,强制删除所有镜像
+ - `docker rmi $(docker images | grep "vmware" | awk '{print $3}')`,批量删除带有 vmware 名称的镜像
+- `docker tag`:为镜像打上标签
+ - `docker tag -f ubuntu:14.04 ubuntu:latest`,-f 意思是强制覆盖
+ - 同一个IMAGE ID可能会有多个TAG(可能还在不同的仓库),首先你要根据这些 image names 来删除标签,当删除最后一个tag的时候就会自动删除镜像;
+ - `docker rmi 仓库:Tag`,取消标签(如果是镜像的最后一个标签,则会删除这个镜像)
+- `docker build`:使用 Dockerfile 创建镜像(推荐)
+ - `docker build . --rm -t runoob/ubuntu:v1`,参数 `-t`,表示:-tag,打标签
+ - 多次 docker build 过程中是有依赖一个缓存的过程的,一般 build 过程都有好几个 step,Docker 非常聪明,会自己判断那些没有被修改过程的 step 采用缓存。如果想要避免使用缓存,可以使用这样命令 **--no-cache**:`docker build --no-cache . --rm -t runoob/ubuntu:v1`
+- `docker history`:显示生成一个镜像的历史命令,可以看出这个镜像的构建过程,包括:每一层镜像的 ID、指令
+- `docker save`:将一个镜像保存为一个 tar 包,带 layers 和 tag 信息(导出一个镜像)
+ - `docker save 镜像ID -o /opt/test.tar`
+- `docker load`:从一个 tar 包创建一个镜像(导入一个镜像)
+ - `docker load -i /opt/test.tar`
+
+
+#### 容器生命周期管理
+
+- `docker run`,运行镜像
+ - `docker run -v /java_logs/:/opt/ -d -p 8080:80 --name=myDockerNameIsGitNavi --hostname=myDockerNameIsGitNavi -i -t 镜像ID /bin/bash`
+ - `-i -t` 分别表示保证容器中的 STDIN 开启,并分配一个伪 tty 终端进行交互,这两个是合着用。
+ - `--name` 是给容器起了一个名字(如果没有主动给名字,docker 会自动给你生成一个)容器的名称规则:大小写字母、数字、下划线、圆点、中横线,用正则表达式来表达就是:[a-zA-Z0-9_*-]
+ - `-d` 容器运行在后台。
+ - `-p 8080:80` 表示端口映射,将宿主机的8080端口转发到容器内的80端口。(如果是 -P 参数,则表示随机映射应该端口,一般用在测试的时候)
+ - `-v /java_logs/:/opt/` 表示目录挂载,/java_logs/ 是宿主机的目录,/opt/ 是容器目录
+ - `docker run --rm --name=myDockerNameIsGitNavi --hostname=myDockerNameIsGitNavi -i -t centos /bin/bash`,--rm,表示退出即删除容器,一般用在做实验测试的时候
+ - `docker run --restart=always -i -t centos /bin/bash`,--restart=always 表示停止后会自动重启
+ - `docker run --restart=on-failure:5 -i -t centos /bin/bash`,--restart=on-failure:5 表示停止后会自动重启,最多重启 5 次
+- `docker exec`:对守护式的容器里面执行命令,方便对正在运行的容器进行维护、监控、管理
+ - `docker exec -i -t 容器ID /bin/bash`,进入正在运行的 docker 容器,并启动终端交互
+ - `docker exec -d 容器ID touch /opt/test.txt`,已守护式的方式进入 docker 容器,并创建一个文件
+- `docker stop 容器ID`,停止容器
+ - `docker stop $(docker ps -a -q)`,停止所有容器
+ - `docker stop $(docker ps -a -q) ; docker rm $(docker ps -a -q)`,停止所有容器,并删除所有容器
+ - `docker kill $(docker ps -q) ; docker rm $(docker ps -a -q)`,停止所有容器,并删除所有容器
+- `docker start 容器ID`,重新启动已经停止的容器(重新启动,docker run 参数还是保留之前的)
+- `docker restart 容器ID`,重启容器
+- `docker rm`,删除容器
+ - `docker rm 容器ID`,删除指定容器(该容器必须是停止的)
+ - `docker rm -f 容器ID`,删除指定容器(该容器如果正在运行可以这样删除)
+ - `docker rm $(docker ps -a -q)`,删除所有容器
+ - `docker rm -f $(docker ps -a -q)`,强制删除所有容器
+ - `docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs docker rm` 删除老的(一周前创建)容器
+ - `docker kill $(docker ps -q) ; docker rm $(docker ps -a -q) ; docker rmi $(docker images -q -a)` 停止所有容器,删除所有容器,删除所有镜像
+- `docker commit`,把容器打成镜像
+ - `docker commit 容器ID gitnavi/docker-nodejs-test:0.1`
+ - gitnavi 是你注册的 https://store.docker.com/ 的名字,如果你没有的话,那需要先注册
+ - docker-nodejs-test 是你为该镜像起的名字
+ - 0.1 是镜像的版本号,默认是 latest 版本
+ - `docker commit -m="这是一个描述信息" --author="GitNavi" 容器ID gitnavi/docker-nodejs-test:0.1`
+ - 在提交镜像时指定更多的数据(包括标签)来详细描述所做的修改
+- `docker diff 容器ID`:显示容器文件系统的前后变化
+- `--link` 同一个宿主机下的不同容器的连接:
+ - `docker run -it 镜像ID --link redis-name:myredis /bin/bash`
+ - `redis-name` 是容器名称
+ - `myredis` 是容器别名,其他容器连接它可以用这个别名来写入到自己的配置文件中
+- 容器与宿主机之间文件的拷贝
+ - `docker cp /www/runoob 96f7f14e99ab:/www/` 将主机 /www/runoob 目录拷贝到容器 96f7f14e99ab 的 /www 目录下
+ - `docker cp /www/runoob 96f7f14e99ab:/www` 将主机 /www/runoob 目录拷贝到容器 96f7f14e99ab 中,目录重命名为 www。
+ - `docker cp 96f7f14e99ab:/www /tmp/` 将容器96f7f14e99ab的/www目录拷贝到主机的/tmp目录中。
+
+
+#### docker 网络模式
+
+- 查看也有网络:`docker network ls`
+- 创建网络:`docker network create --subnet=172.19.0.0/16 net-redis-to-cluster`
+- 已有容器连接到某个网络(一个容器可以同时连上多个网络):`docker network connect net-redis-to-cluster my-redis-container`
+- 如果是内网提供服务的,可以直接创建一个网络,其服务使用该网络。然后另外一个需要调用该服务的,并且是对外网提供服务的可以使用 host 模式
+- `--network XXXXXX` 常见几种模式
+ - bridge 默认模式,在 docker0 的网桥上创建新网络栈,确保独立的网络环境,实现网络隔离:`docker run -it 镜像ID --network=bridge /bin/bash`
+ - none 不适用网卡,不会有 IP,无法联网:`docker run -it 镜像ID --network=none /bin/bash`
+ - host 使用宿主机网络 IP、端口联网(在容器里面输入:ip a,看到的结果和在宿主机看到的一样):`docker run -it 镜像ID --network=host /bin/bash`
+ - 自定义-使用自己命名的网络栈,但是需要手动配置网卡、IP 信息:`docker run -it 镜像ID --network=自定义名称 /bin/bash`
+
+
+
+#### 容器管理操作
+
+- `docker ps`:列出当前所有 **正在运行** 的容器
+ - `docker ps -a`:列出所有的容器(包含历史,即运行过的容器)
+ - `docker ps -l`:列出最近一次启动的container
+ - `docker ps -q`:列出最近一次运行的container ID
+ - `docker ps -a -l`:列出最后一次运行的容器
+ - `docker ps -n x`:显示最后 x 个容器,不管是正在运行或是已经停止的
+- `docker top 容器ID`:显示容器的进程信息
+- `docker events`:得到 docker 服务器的实时的事件
+- `docker logs -f 容器ID`:查看容器日志(如果一些容器不断重启,或是自动停止,可以这样看下)
+ - `docker logs 容器ID`,获取守护式容器的日志
+ - `docker logs -f 容器ID`,不断监控容器日志,类似 tail -f
+ - `docker logs -ft 容器ID`,在 -f 的基础上又增加 -t 表示为每条日志加上时间戳,方便调试
+ - `docker logs --tail 10 容器ID`,获取日志最后 10 行
+ - `docker logs --tail 0 -f 容器ID`,跟踪某个容器的最新日志而不必读取日志文件
+ - `docker logs -f -t --since="2018-05-26" --tail=200 容器ID` 根据某个时间读取日志
+ - `docker logs -f -t --since="2018-05-26T11:13:40" --tail=200 容器ID` 根据某个时间读取日志
+ - `docker logs -f -t --since="2018-05-25T11:13:40" --until "2018-05-26T11:13:40" --tail=200 容器ID` 根据某个时间读取日志
+ - `docker logs --since 10m 容器ID` 查看最近 10 分钟的日志
+ - `-f` : 表示查看实时日志
+ - `-t` : 显示时间戳
+ - `-since` : 显示某个开始时间的所有日志
+ - `-tail=200` : 查看最后的 200 条日志
+- `docker wait`,阻塞到一个容器,直到容器停止运行
+- `docker export`,将容器整个文件系统导出为一个tar包,不带layers、tag等信息
+- `docker port`,显示容器的端口映射
+- `docker inspect 容器ID`:查看容器的全面信息,用 JSON 格式输出
+- `docker inspect network名称`:查看 network 信息,用 JSON 格式输出,包含使用该网络的容器有哪些
+- `docker system df`:类似于 Linux 上的 df 命令,用于查看 Docker 的磁盘使用情况
+ - Images 镜像
+ - Containers 容器
+ - Local Volumes 数据卷
+
+```
+TYPE TOTAL ACTIVE SIZE RECLAIMABLE
+Images 6 6 1.049GB 0B (0%)
+Containers 7 4 10.25kB 0B (0%)
+Local Volumes 13 5 38.49GB 1.365MB (0%)
+Build Cache 0B 0B
+```
+
+```
+获取容器中的 IP:docker inspect -f {{.NetworkSettings.IPAddress}} 容器ID
+获取容器中的 IP:docker inspect -f {{.Volumes}} 容器ID
+查看容器的挂载情况:docker inspect 容器ID | grep Mounts -A 10
+```
+
+- 下面为一个 docker inspect 后的结果示例:
+
+```json
+[
+ {
+ "Id": "e1dff77b99d9c8489e0a0ce68a19ec5ffe18cc5d8b8ec17086f7f7bea29aa09b",
+ "Created": "2018-01-18T03:47:16.138180181Z",
+ "Path": "docker-entrypoint.sh",
+ "Args": [
+ "--auth"
+ ],
+ "State": {
+ "Status": "running",
+ "Running": true,
+ "Paused": false,
+ "Restarting": false,
+ "OOMKilled": false,
+ "Dead": false,
+ "Pid": 19952,
+ "ExitCode": 0,
+ "Error": "",
+ "StartedAt": "2018-01-18T03:47:16.348568927Z",
+ "FinishedAt": "0001-01-01T00:00:00Z"
+ },
+ "Image": "sha256:42aa46cfbd7a0d1101311defac39872b447b32295b40f9c99104ede5d02e9677",
+ "ResolvConfPath": "/var/lib/docker/containers/e1dff77b99d9c8489e0a0ce68a19ec5ffe18cc5d8b8ec17086f7f7bea29aa09b/resolv.conf",
+ "HostnamePath": "/var/lib/docker/containers/e1dff77b99d9c8489e0a0ce68a19ec5ffe18cc5d8b8ec17086f7f7bea29aa09b/hostname",
+ "HostsPath": "/var/lib/docker/containers/e1dff77b99d9c8489e0a0ce68a19ec5ffe18cc5d8b8ec17086f7f7bea29aa09b/hosts",
+ "LogPath": "/var/lib/docker/containers/e1dff77b99d9c8489e0a0ce68a19ec5ffe18cc5d8b8ec17086f7f7bea29aa09b/e1dff77b99d9c8489e0a0ce68a19ec5ffe18cc5d8b8ec17086f7f7bea29aa09b-json.log",
+ "Name": "/cas-mongo",
+ "RestartCount": 0,
+ "Driver": "overlay",
+ "Platform": "linux",
+ "MountLabel": "",
+ "ProcessLabel": "",
+ "AppArmorProfile": "",
+ "ExecIDs": null,
+ "HostConfig": {
+ "Binds": [
+ "/data/mongo/db:/data/db"
+ ],
+ "ContainerIDFile": "",
+ "LogConfig": {
+ "Type": "json-file",
+ "Config": {}
+ },
+ "NetworkMode": "default",
+ "PortBindings": {
+ "27017/tcp": [
+ {
+ "HostIp": "",
+ "HostPort": "27017"
+ }
+ ]
+ },
+ "RestartPolicy": {
+ "Name": "always",
+ "MaximumRetryCount": 0
+ },
+ "AutoRemove": false,
+ "VolumeDriver": "",
+ "VolumesFrom": null,
+ "CapAdd": null,
+ "CapDrop": null,
+ "Dns": [],
+ "DnsOptions": [],
+ "DnsSearch": [],
+ "ExtraHosts": null,
+ "GroupAdd": null,
+ "IpcMode": "shareable",
+ "Cgroup": "",
+ "Links": null,
+ "OomScoreAdj": 0,
+ "PidMode": "",
+ "Privileged": false,
+ "PublishAllPorts": false,
+ "ReadonlyRootfs": false,
+ "SecurityOpt": null,
+ "UTSMode": "",
+ "UsernsMode": "",
+ "ShmSize": 67108864,
+ "Runtime": "runc",
+ "ConsoleSize": [
+ 0,
+ 0
+ ],
+ "Isolation": "",
+ "CpuShares": 0,
+ "Memory": 0,
+ "NanoCpus": 0,
+ "CgroupParent": "",
+ "BlkioWeight": 0,
+ "BlkioWeightDevice": [],
+ "BlkioDeviceReadBps": null,
+ "BlkioDeviceWriteBps": null,
+ "BlkioDeviceReadIOps": null,
+ "BlkioDeviceWriteIOps": null,
+ "CpuPeriod": 0,
+ "CpuQuota": 0,
+ "CpuRealtimePeriod": 0,
+ "CpuRealtimeRuntime": 0,
+ "CpusetCpus": "",
+ "CpusetMems": "",
+ "Devices": [],
+ "DeviceCgroupRules": null,
+ "DiskQuota": 0,
+ "KernelMemory": 0,
+ "MemoryReservation": 0,
+ "MemorySwap": 0,
+ "MemorySwappiness": null,
+ "OomKillDisable": false,
+ "PidsLimit": 0,
+ "Ulimits": null,
+ "CpuCount": 0,
+ "CpuPercent": 0,
+ "IOMaximumIOps": 0,
+ "IOMaximumBandwidth": 0
+ },
+ "GraphDriver": {
+ "Data": {
+ "LowerDir": "/var/lib/docker/overlay/0ab08b1f9c8f5f70cdcac2b01d9ee31de9e5a4955003567573635e8837931249/root",
+ "MergedDir": "/var/lib/docker/overlay/4d6bb0d57f3f1b1dcf98c70b4bee4abf8dc110c7efa685ee5d84fe6f58c07b63/merged",
+ "UpperDir": "/var/lib/docker/overlay/4d6bb0d57f3f1b1dcf98c70b4bee4abf8dc110c7efa685ee5d84fe6f58c07b63/upper",
+ "WorkDir": "/var/lib/docker/overlay/4d6bb0d57f3f1b1dcf98c70b4bee4abf8dc110c7efa685ee5d84fe6f58c07b63/work"
+ },
+ "Name": "overlay"
+ },
+ "Mounts": [
+ {
+ "Type": "volume",
+ "Name": "6cd9721ff6a2768cd20e4a0678b176fa81a5de1c7d21fe6212b50c6854196db2",
+ "Source": "/var/lib/docker/volumes/6cd9721ff6a2768cd20e4a0678b176fa81a5de1c7d21fe6212b50c6854196db2/_data",
+ "Destination": "/data/configdb",
+ "Driver": "local",
+ "Mode": "",
+ "RW": true,
+ "Propagation": ""
+ },
+ {
+ "Type": "bind",
+ "Source": "/data/mongo/db",
+ "Destination": "/data/db",
+ "Mode": "",
+ "RW": true,
+ "Propagation": "rprivate"
+ }
+ ],
+ "Config": {
+ "Hostname": "e1dff77b99d9",
+ "Domainname": "",
+ "User": "",
+ "AttachStdin": false,
+ "AttachStdout": false,
+ "AttachStderr": false,
+ "ExposedPorts": {
+ "27017/tcp": {}
+ },
+ "Tty": false,
+ "OpenStdin": false,
+ "StdinOnce": false,
+ "Env": [
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ "GOSU_VERSION=1.7",
+ "GPG_KEYS=0C49F3730359A14518585931BC711F9BA15703C6",
+ "MONGO_PACKAGE=mongodb-org",
+ "MONGO_REPO=repo.mongodb.org",
+ "MONGO_MAJOR=3.4",
+ "MONGO_VERSION=3.4.10"
+ ],
+ "Cmd": [
+ "--auth"
+ ],
+ "Image": "mongo:3.4",
+ "Volumes": {
+ "/data/configdb": {},
+ "/data/db": {}
+ },
+ "WorkingDir": "",
+ "Entrypoint": [
+ "docker-entrypoint.sh"
+ ],
+ "OnBuild": null,
+ "Labels": {}
+ },
+ "NetworkSettings": {
+ "Bridge": "",
+ "SandboxID": "7eabf418238f4d9f5fd5163fd4d173bbaea7764687a5cf40a9757d42b90ab2f9",
+ "HairpinMode": false,
+ "Link LocalIPv6Address": "",
+ "LinkLocalIPv6PrefixLen": 0,
+ "Ports": {
+ "27017/tcp": [
+ {
+ "HostIp": "0.0.0.0",
+ "HostPort": "27017"
+ }
+ ]
+ },
+ "SandboxKey": "/var/run/docker/netns/7eabf418238f",
+ "SecondaryIPAddresses": null,
+ "SecondaryIPv6Addresses": null,
+ "EndpointID": "11c8d10a4be63b4ed710add6c440adf9d090b71918d4aaa837c46258e5425b80",
+ "Gateway": "172.17.0.1",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "MacAddress": "02:42:ac:11:00:02",
+ "Networks": {
+ "bridge": {
+ "IPAMConfig": null,
+ "Links": null,
+ "Aliases": null,
+ "NetworkID": "ada97659acda146fc57e15a099e430a6e97de87f6d043b91d4c3582f6ab52d47",
+ "EndpointID": "11c8d10a4be63b4ed710add6c440adf9d090b71918d4aaa837c46258e5425b80",
+ "Gateway": "172.17.0.1",
+ "IPAddress": "172.17.0.2",
+ "IPPrefixLen": 16,
+ "IPv6Gateway": "",
+ "GlobalIPv6Address": "",
+ "GlobalIPv6PrefixLen": 0,
+ "MacAddress": "02:42:ac:11:00:02",
+ "DriverOpts": null
+ }
+ }
+ }
+ }
+]
+```
+
+## Docker 容器产生的 log 位置
+
+- Docker 运行一段时间,如果你的容器有大量的输出信息,则这个 log 文件会非常大,所以要考虑清理。
+- log 位置:`/var/lib/docker/containers/容器ID值/容器ID值-json.log`
+- 可以考虑在停到容器的时候备份这个文件到其他位置,然后:`echo > 容器ID值-json.log`
+- 当然,官网也提供了自动化的方案:
+ - 修改 Docker 是配置文件:`vim /etc/docker/daemon.json`,(如果没有这个文件,自己新增)增加如下内容:
+
+``` bash
+{
+ "log-driver": "json-file",
+ "log-opts": {
+ "max-size": "10m",
+ "max-file": "5"
+ }
+}
+```
+
+- 如果你已经有该文件文件莱使用国内源,那修改方案应该是这样的:
+
+``` bash
+{
+ "registry-mirrors": ["https://ldhc17y9.mirror.aliyuncs.com"],
+ "log-driver": "json-file",
+ "log-opts": {
+ "max-size": "10m",
+ "max-file": "5"
+ }
+}
+```
+
+## 删除 Docker 镜像中为 none 的镜像
+
+- Dockerfile 代码更新频繁,自然 docker build 构建同名镜像也频繁的很,产生了众多名为 none 的无用镜像
+
+
+```
+docker rmi $(docker images -f "dangling=true" -q)
+```
+
+## Docker daemon.json 可配置参数
+
+-
+
+
+## Docker remote api 远程操作配置(保证在内网环境)
+
+- 假设要被远程操作的服务器 IP:`192.168.1.22`
+- 修改其配置文件:`vim /lib/systemd/system/docker.service`
+- 修改默认值为:`ExecStart=/usr/bin/dockerd`
+- 改为:`ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2376`
+ - 如果还需要连自己的 harbor 这类,完整配置:`ExecStart=/usr/bin/dockerd --insecure-registry harbor.youmeek.com -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2376`
+- `systemctl daemon-reload`
+- `systemctl reload docker`
+- `systemctl restart docker`
+- 验证:
+ - 在其他服务器上运行:`docker -H 192.168.1.22:2376 images `
+ - 能拿到和它本身看到的一样的数据表示可以了
+
+
+## Dockerfile 解释
+
+- 该文件名就叫 Dockerfile,注意大小写,没有后缀,否则会报错。
+- 主要由下面几个部分组成:
+ - 基础镜像信息
+ - 维护者/创建者信息
+ - 镜像操作指令
+ - 容器启动时执行执行
+- 注释符号:`# 这是一段注释说明`
+- 常用指令关键字:
+ - `FROM`,基础镜像信息
+ - `MAINTAINER`,维护者/创建者信息
+ - `ADD`,添加文件。如果添加的文件是类似 tar.gz 压缩包,会自动解压。
+ - 特别注意的是:ADD 文件到镜像的地址如果是目录,则需要最后保留斜杠,比如:`ADD test.tar.gz /opt/shell/`。不是斜杠结尾会认为是文件。
+ - 添加文件格式:`ADD test.sh /opt/shell/test.sh`
+ - 添加压缩包并解压格式:`ADD test.tar.gz /opt/shell/`,该压缩包会自动解压在 /opt/shell 目录下
+ - `COPY`,类似 ADD,只是 COPY 只是复制文件,不会做类似解压压缩包这种行为。
+ - `COPY /opt/conf/ /etc/` 把宿主机的 /opt/conf 下文件复制到镜像的 /etc 目录下。
+ - `WORKDIR`,设置工作目录,可以理解为类似 cd 命令,表示现在在某个目录路径,然后下面的 CMD、ENTRYPOINT 操作都是基于此目录
+ - `VOLUME`,目录挂载
+ - `EXPOSE`,暴露端口
+ - `USER`,指定该镜像以什么用户去运行,也可以用这个来指定:`docker run -u root`。不指定默认是 root
+ - `ENV`,定义环境变量,该变量可以在后续的任何 RUN 指令中使用,使用方式:$HOME_DIR。在 docker run 的时候可以该方式来覆盖变量值 `docker run -e “HOME_DIR=/opt”`
+ - `RUN`,执行命令并创建新的镜像层,RUN 经常用于安装软件包
+ - `CMD`,执行命令,并且一个 Dockerfile 只能有一条 CMD,有多条的情况下最后一条有效。在一种场景下 CMD 命令无效:docker run 的时候也指定了相同命令,则 docker run 命令优先级最高
+ - `ENTRYPOINT`,配置容器启动时运行的命令,不会被 docker run 指令覆盖,并且 docker run 的指令可以作为参数传递到 ENTRYPOINT 中。要覆盖 ENTRYPOINT 命令也是有办法的:docker run --entrypoint 方式。Dockerfile 同时有 CMD 和 ENTRYPOINT 的时候,CMD 的指令是作为参数传递给 ENTRYPOINT 使用。
+ - 特别注意:RUN、CMD 和 ENTRYPOINT 这三个 Dockerfile 指令看上去很类似,很容易混淆。
+ - 最佳实战:[来源](https://www.ibm.com/developerworks/community/blogs/132cfa78-44b0-4376-85d0-d3096cd30d3f/entry/RUN_vs_CMD_vs_ENTRYPOINT_%E6%AF%8F%E5%A4%A95%E5%88%86%E9%92%9F%E7%8E%A9%E8%BD%AC_Docker_%E5%AE%B9%E5%99%A8%E6%8A%80%E6%9C%AF_17?lang=en_us)
+ - 使用 RUN 指令安装应用和软件包,构建镜像。
+ - 如果 Docker 镜像的用途是运行应用程序或服务,比如运行一个 MySQL,应该优先使用 Exec 格式的 ENTRYPOINT 指令。CMD 可为 ENTRYPOINT 提供额外的默认参数,同时可利用 docker run 命令行替换默认参数。
+ - 如果想为容器设置默认的启动命令,可使用 CMD 指令。用户可在 docker run 命令行中替换此默认命令。
+
+
+## Dockerfile 部署 Spring Boot 应用
+
+- jar 名称:skb-user-0.0.1-SNAPSHOT.jar
+- 打算用的宿主机端口:9096
+- Dockerfile 文件和 jar 文件存放在宿主机目录:/opt/zch
+- Dockerfile 内容如下:
+
+``` bash
+FROM java:8-jre
+MAINTAINER gitnavi
+
+ENV TZ=Asia/Shanghai
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+ADD skb-user-0.0.1-SNAPSHOT.jar /usr/local/skb/user/
+
+CMD ["java", "-Xmx500m", "-jar", "/usr/local/skb/user/skb-user-0.0.1-SNAPSHOT.jar", "--spring.profiles.active=test"]
+
+EXPOSE 9096
+```
+
+- 开始构建:
+ - `cd /opt/zch`
+ - `docker build . --tag="skb/user:v1.0.1"`
+ - 因为 build 过程中会有多层镜像 step 过程,所以如果 build 过程中失败,那解决办法的思路是找到 step 失败的上一层,成功的 step 中镜像 ID。然后 docker run 该镜像 ID,手工操作,看报什么错误,然后就比较清晰得了解错误情况了。
+ - `docker run -d -p 9096:9096 -v /usr/local/logs/:/opt/ --name=skbUser --hostname=skbUser skb/user:v1.0.1`
+ - 查看启动后容器列表:`docker ps`
+ - jar 应用的日志是输出在容器的 /opt 目录下,因为我们上面用了挂载,所在在我们宿主机的 /usr/local/logs 目录下可以看到输出的日志
+- 防火墙开放端口:
+ - `firewall-cmd --zone=public --add-port=9096/tcp --permanent`
+ - `firewall-cmd --reload`
+- 解释:
+
+```
+# 是为了解决容器的时区和宿主机不一致问题
+ENV TZ=Asia/Shanghai
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+```
+
+## Dockerfile 部署 Tomcat 应用
+
+- 编写 Dockerfile
+
+```
+FROM tomcat:8.0.46-jre8
+MAINTAINER GitNavi
+
+ENV JAVA_OPTS="-Xms2g -Xmx2g -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=312M"
+ENV CATALINA_HOME /usr/local/tomcat
+
+ENV TZ=Asia/Shanghai
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+RUN rm -rf /usr/local/tomcat/webapps/*
+
+ADD qiyeweixin.war /usr/local/tomcat/webapps/
+
+EXPOSE 8080
+
+CMD ["catalina.sh", "run"]
+```
+
+- 打包镜像:`docker build -t harbor.gitnavi.com/demo/qiyeweixin:1.2.2 ./`
+- 运行:`docker run -d -p 8888:8080 --name=qiyeweixin --hostname=qiyeweixin -v /data/docker/logs/qiyeweixin:/data/logs/qiyeweixin harbor.gitnavi.com/demo/qiyeweixin:1.2.2`
+- 带 JVM 参数运行:`docker run -d -p 8888:8080 -e JAVA_OPTS='-Xms7g -Xmx7g -XX:MetaspaceSize=128M -XX:MaxMetaspaceSize=512M' --name=qiyeweixin --hostname=qiyeweixin -v /data/docker/logs/qiyeweixin:/data/logs/qiyeweixin harbor.gitnavi.com/demo/qiyeweixin:1.2.2`
+ - 虽然 Dockerfile 已经有 JVM 参数,并且也是有效的。但是如果 docker run 的时候又带了 JVM 参数,则会以 docker run 的参数为准
+- 测试 JVM 是否有效方法,在代码里面书写,该值要接近 xmx 值:
+
+```
+long maxMemory = Runtime.getRuntime().maxMemory();
+logger.warn("-------------maxMemory=" + ((double) maxMemory / (1024 * 1024)));
+```
+
+## Docker Compose
+
+- Docker Compose 主要用于定义和运行多个 Docker 容器的工具,这样可以快速运行一套分布式系统
+ - 容器之间是有依赖关系,比如我一个 Java web 系统依赖 DB 容器、Redis 容器,必须这些依赖容器先运行起来。
+- 一个文件:docker-compose.yml
+- 一个命令:`docker-compose up`
+ - 指定文件:`docker-compose -f zookeeper.yml -p zk_test up -d`
+- 官网安装说明:
+- 安装方法:
+
+```
+sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
+
+sudo chmod +x /usr/local/bin/docker-compose
+
+```
+
+- 检查是否安装成功:`docker-compose --version`,输出:`docker-compose version 1.18.0, build 8dd22a9`
+- 常用命令:
+ - 运行:`docker-compose up -d`
+ - 停止运行:`docker-compose down`
+ - 查看容器:`docker-compose ps`
+ - 删除停止的服务容器:`docker-compose rm`
+
+## Docker Swarm
+
+- Docker Swarm 是一个 Docker 集群管理工具
+
+
+## Harbor 镜像私有仓库
+
+- 官网:
+
+## 资料
+
+- 书籍:《第一本 Docker 书》
+- []()
+- []()
+- []()
+- []()
+- []()
+- []()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/markdown-file/Dubbo-Install-And-Settings.md b/markdown-file/Dubbo-Install-And-Settings.md
new file mode 100644
index 00000000..8b225d0c
--- /dev/null
+++ b/markdown-file/Dubbo-Install-And-Settings.md
@@ -0,0 +1,213 @@
+# Dubbo 环境安装和配置
+
+
+## Dubbo-Admin 搭建
+
+### 需要环境
+
+- CentOS 6
+- JDK 1.8(必须是 1.8)
+- Tomcat 7 或 8(我测试都可以)
+- Dubbo 版本:2.5.4-SNAPSHOT(当前这个版本是最新的。2.5.3 我测试是不行的)
+- Dubbo-Admin 需要修改部分代码,让它支持 JDK 8,具体看文章:
+- 最终我的 Dubbo-admin 的 pom.xml 为这样的:
+
+
+``` xml
+
+
+ 4.0.0
+
+ com.alibaba
+ dubbo-parent
+ 2.5.4-SNAPSHOT
+
+ dubbo-admin
+ war
+ ${project.artifactId}
+ The admin module of dubbo project
+
+ 1.5
+ /
+ false
+ false
+
+
+
+ com.alibaba
+ dubbo
+ ${project.parent.version}
+
+
+ org.springframework
+ spring
+
+
+
+
+
+ com.alibaba.citrus
+ citrus-webx-all
+ 3.1.6
+
+
+ org.apache.velocity
+ velocity
+ 1.7
+
+
+
+ org.javassist
+ javassist
+
+
+ org.jboss.netty
+ netty
+
+
+ org.apache.mina
+ mina-core
+
+
+ org.glassfish.grizzly
+ grizzly-core
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+ com.alibaba
+ fastjson
+
+
+ com.thoughtworks.xstream
+ xstream
+
+
+ org.apache.bsf
+ bsf-api
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+ com.github.sgroschupf
+ zkclient
+
+
+ com.netflix.curator
+ curator-framework
+
+
+ com.googlecode.xmemcached
+ xmemcached
+
+
+ org.apache.thrift
+ libthrift
+
+
+ com.caucho
+ hessian
+
+
+ javax.servlet
+ servlet-api
+ provided
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ redis.clients
+ jedis
+
+
+ javax.validation
+ validation-api
+
+
+ org.hibernate
+ hibernate-validator
+
+
+ javax.cache
+ cache-api
+
+
+
+
+
+ org.mortbay.jetty
+ maven-jetty-plugin
+ ${jetty_version}
+
+ /
+ 10
+
+
+ 8080
+ 60000
+
+
+
+
+
+
+
+
+```
+
+- 部署在 Tomcat 之后,如果需要修改 zookeeper 的地址,以及默认用户的登录密码,可以在这里改:`vim /usr/program/tomcat8/webapps/ROOT/WEB-INF/dubbo.properties`
+- 里面内容:
+
+``` ini
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.admin.root.password=root
+dubbo.admin.guest.password=guest
+```
+
+- 如果有多个节点构成的集群也可以这样写:
+
+``` ini
+dubbo.registry.address=zookeeper://192.168.1.121:2181?backup=192.168.1.111:2181,192.168.1.112:2181
+dubbo.admin.root.password=root
+dubbo.admin.guest.password=guest
+```
+
+
+## Dubbox-Admin 搭建
+
+### 需要环境
+
+- CentOS 6
+- JDK 1.8(只测试过 1.8)
+- Tomcat 7 或 8(只测试过 8)
+- Dubbox 版本:dubbo-admin-2.8.4.war(fork 官网最新版本,自己编译的版本)
+- 不需要修改任何 pom.xml 文件,直接就可以运行。
\ No newline at end of file
diff --git a/markdown-file/ELK-Install-And-Settings.md b/markdown-file/ELK-Install-And-Settings.md
new file mode 100644
index 00000000..26fbda70
--- /dev/null
+++ b/markdown-file/ELK-Install-And-Settings.md
@@ -0,0 +1,38 @@
+# ELK(Elasticsearch、Logstash、Kibana)安装和配置
+
+## 版本说明
+
+- 本文包含了:Elasticsearch 2.4.X 和 Elasticsearch 5.2.X 和 Elasticsearch 5.5.X,请有针对性地选择。
+
+## 教程说明
+
+
+- 官网:
+- 官网总文档:
+- 官网最终指南:
+- 官网对各个系统的支持列表:
+- 5.2 版本有一个设置的新特性必须了解,测试建议我们用 CentOS 7:
+- Elasticsearch 开源分布式搜索引擎,它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful 风格接口,多数据源,自动搜索负载等。
+- Logstash 日志进行收集、分析,并将其存储供以后使用(如,搜索)
+- kibana 为 Logstash 和 ElasticSearch 提供的日志分析友好的 Web 界面,可以帮助您汇总、分析和搜索重要数据日志。
+
+
+### Elasticsearch 部署
+
+- 请看 Elasticsearch 专题文:[Elasticsearch 相关知识](Elasticsearch-Base.md)
+
+
+### logstash
+
+- 请看 logstash 专题文:[logstash 相关知识](Logstash-Base.md)
+
+
+
+## 资料
+
+-
+-
+-
+-
+- <>
+- <>
diff --git a/markdown-file/Elasticsearch-Base.md b/markdown-file/Elasticsearch-Base.md
new file mode 100644
index 00000000..959a7a93
--- /dev/null
+++ b/markdown-file/Elasticsearch-Base.md
@@ -0,0 +1,728 @@
+# Elasticsearch 知识
+
+## Docker 单节点部署
+
+- 官网:
+- 官网列表:
+- 阿里云支持版本:
+ - 阿里云有一个 `插件配置` 功能,常用的 Elasticsearch 插件都带了,勾选下即可安装。也支持上传安装。
+- 注意:docker 版本下 client.transport.sniff = true 是无效的。
+
+#### 5.6.x
+
+- `vim ~/elasticsearch-5.6.8-docker.yml`
+- 启动:`docker-compose -f ~/elasticsearch-5.6.8-docker.yml -p elasticsearch_5.6.8 up -d`
+
+```
+version: '3'
+services:
+ elasticsearch1:
+ image: docker.elastic.co/elasticsearch/elasticsearch:5.6.8
+ container_name: elasticsearch-5.6.8
+ environment:
+ - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
+ - "cluster.name=elasticsearch"
+ - "network.host=0.0.0.0"
+ - "http.host=0.0.0.0"
+ - "xpack.security.enabled=false"
+ ulimits:
+ memlock:
+ soft: -1
+ hard: -1
+ nofile:
+ soft: 65536
+ hard: 65536
+ ports:
+ - 9200:9200
+ - 9300:9300
+ volumes:
+ - /data/docker/elasticsearch/data:/usr/share/elasticsearch/data
+
+```
+
+
+#### 6.7.x(带 ik 分词)
+
+- `vim ~/elasticsearch-6.7.2-docker.yml`
+- 启动:`docker-compose -f ~/elasticsearch-6.7.2-docker.yml -p elasticsearch_6.7.2 up -d`
+- `mkdir -p /data/docker/elasticsearch-6.7.2/data`
+- 如果官网镜像比较慢可以换成阿里云:`registry.cn-hangzhou.aliyuncs.com/elasticsearch/elasticsearch:6.7.2`
+- 下载 ik 分词(版本必须和 Elasticsearch 版本对应,包括小版本号):
+
+```
+version: '3'
+services:
+ elasticsearch1:
+ image: docker.elastic.co/elasticsearch/elasticsearch:6.7.2
+ container_name: elasticsearch-6.7.2
+ environment:
+ - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
+ - "cluster.name=elasticsearch"
+ - "network.host=0.0.0.0"
+ - "http.host=0.0.0.0"
+ - "xpack.security.enabled=false"
+ ulimits:
+ memlock:
+ soft: -1
+ hard: -1
+ nofile:
+ soft: 65536
+ hard: 65536
+ ports:
+ - 9200:9200
+ - 9300:9300
+ volumes:
+ - /data/docker/elasticsearch-6.7.2/data:/usr/share/elasticsearch/data
+ - /data/docker/ik:/usr/share/elasticsearch/plugins/ik
+```
+
+- Elasticsearch Head 插件地址:
+- 测试:
+
+
+```
+http://localhost:9200/
+_analyze?pretty POST
+
+
+{"analyzer":"ik_smart","text":"安徽省长江流域"}
+```
+
+- ik_max_word 和 ik_smart 什么区别?
+
+```
+ik_max_word: 会将文本做最细粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,中华人民,中华,华人,人民共和国,人民,人,民,共和国,共和,和,国国,国歌”,会穷尽各种可能的组合,适合 Term Query;
+ik_smart: 会做最粗粒度的拆分,比如会将“中华人民共和国国歌”拆分为“中华人民共和国,国歌”,适合 Phrase 查询。
+```
+
+
+-------------------------------------------------------------------
+
+
+## Elasticsearch 6.5.x 安装(适配与 5.5.x,6.6.x)
+
+#### 环境
+
+- CentOS 7.x
+- 至少需要 2G 内存
+- root 用户
+- JDK 版本:1.8(最低要求),主推:JDK 1.8.0_121 以上
+- 关闭 firewall
+ - `systemctl stop firewalld.service` #停止firewall
+ - `systemctl disable firewalld.service` #禁止firewall开机启动
+
+#### 先配置部分系统变量
+
+- 更多系统层面的配置可以看官网:
+- 配置系统最大打开文件描述符数:`vim /etc/sysctl.conf`
+
+```
+fs.file-max=65535
+vm.max_map_count=262144
+```
+
+- 配置进程最大打开文件描述符:`vim /etc/security/limits.conf`
+
+```
+elasticsearch soft memlock unlimited
+elasticsearch hard memlock unlimited
+* soft nofile 262144
+* hard nofile 262144
+```
+
+#### 开始安装
+
+- 检查:`rpm -qa | grep elastic`
+- 卸载:`rpm -e --nodeps elasticsearch`
+- 官网 RPM 安装流程(重要,以下资料都是对官网的总结):
+- 导入 KEY:`rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch`
+- 新建文件:`vim /etc/yum.repos.d/elasticsearch.repo`
+- 内容如下(6.x):
+
+```
+[elasticsearch-6.x]
+name=Elasticsearch repository for 6.x packages
+baseurl=https://artifacts.elastic.co/packages/6.x/yum
+gpgcheck=1
+gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
+enabled=1
+autorefresh=1
+type=rpm-md
+```
+
+- 内容如下(5.x):
+
+```
+[elasticsearch-5.x]
+name=Elasticsearch repository for 5.x packages
+baseurl=https://artifacts.elastic.co/packages/5.x/yum
+gpgcheck=1
+gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
+enabled=1
+autorefresh=1
+type=rpm-md
+```
+
+- 开始安装:`yum install -y elasticsearch`,预计文件有 108M 左右,国内网络安装可能会很慢,慢慢等
+ - 安装完后会多了一个:elasticsearch 用户和组
+- 设置 java 软链接:`ln -s /usr/local/jdk1.8.0_181/jre/bin/java /usr/local/sbin/java`
+- 启动和停止软件(默认是不启动的):
+ - 启动:`systemctl start elasticsearch.service`
+ - 状态:`systemctl status elasticsearch.service`
+ - 停止:`systemctl stop elasticsearch.service`
+ - 重新启动:`systemctl restart elasticsearch.service`
+- 安装完成后,增加系统自启动:
+ - `/bin/systemctl daemon-reload`
+ - `/bin/systemctl enable elasticsearch.service`
+- 检查:`curl -X GET "localhost:9200/"`
+
+#### RPM 安装后的一些配置位置说明
+
+- 更多说明可以看官网:
+- 更加详细的配置可以看:
+- 默认系统生成了一个 elasticsearch 用户,下面的目录权限属于该用户
+- Elasticsearch 安装后位置:`/usr/share/elasticsearch`
+- Elasticsearch 的软件环境、堆栈的设置:`/etc/sysconfig/elasticsearch`
+- Elasticsearch 的集群设置:`/etc/elasticsearch/elasticsearch.yml`
+- Log 位置:`/var/log/elasticsearch/`
+- 索引数据位置:`/var/lib/elasticsearch`
+- 插件位置:`/usr/share/elasticsearch/plugins`
+- 脚本文件位置:`/etc/elasticsearch/scripts`
+
+#### 配置
+
+- 编辑配置文件:`vim /etc/elasticsearch/elasticsearch.yml`
+- 默认只能 localhost 访问,修改成支持外网访问
+
+```
+打开这个注释:#cluster.name: my-application
+集群名称最好是自己给定,不然有些 client 端会连不上,或者要求填写
+
+打开这个注释:#network.host: 192.168.0.1
+改为:network.host: 0.0.0.0
+```
+
+#### 安装 X-Pack(6.5.x 默认带了 x-pack)
+
+- `cd /usr/share/elasticsearch && bin/elasticsearch-plugin install x-pack`
+
+#### GUI 客户端工具
+
+- 优先推荐:
+-
+
+
+#### 安装 Chrome 扩展的 Head
+
+- 下载地址:
+
+#### 其他细节
+
+- 如果就单个节点测试,新建索引的时候副本数记得填 0。
+
+#### 创建索引并设置 mapping
+
+- 官网类型说明:
+
+```
+curl -XPUT 'http://127.0.0.1:9200/grafanadb' -H 'Content-Type: application/json' -d'
+{
+ "settings": {
+ "refresh_interval": "5s",
+ "number_of_shards": 5,
+ "number_of_replicas": 0
+ },
+ "mappings": {
+ "radar": {
+ "properties": {
+ "request_num": {
+ "type": "long"
+ },
+ "post_date": {
+ "type": "date",
+ "format": "yyyy-MM-dd HH:mm:ss||epoch_millis"
+ }
+ }
+ }
+ }
+}
+'
+```
+
+
+#### 批量增加 / 删除测试数据
+
+- 官网文档:
+- 批量增加,cURL 格式:
+
+```
+curl -X POST "http://127.0.0.1:9200/_bulk" -H 'Content-Type: application/json' -d'
+{ "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100001" } }
+{ "post_date" : "2018-12-01 10:00:00", "request_num" : 1 }
+{ "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100002" } }
+{ "post_date" : "2018-12-01 10:00:05", "request_num" : 2 }
+{ "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100003" } }
+{ "post_date" : "2018-12-01 10:00:10", "request_num" : 3 }
+{ "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100004" } }
+{ "post_date" : "2018-12-01 10:00:15", "request_num" : 4 }
+{ "index" : { "_index" : "grafanadb", "_type" : "radar", "_id" : "100005" } }
+{ "post_date" : "2018-12-01 10:00:20", "request_num" : 5 }
+'
+```
+
+- 批量删除,cURL 格式:
+
+```
+curl -X POST "http://127.0.0.1:9200/_bulk" -H 'Content-Type: application/json' -d'
+{ "delete": { "_index": "grafanadb", "_type": "radar", "_id": "100001" } }
+{ "delete": { "_index": "grafanadb", "_type": "radar", "_id": "100002" } }
+'
+```
+
+- 清空索引所有数据,分成5个切片去执行删除,cURL 格式:
+
+```
+curl -X POST "http://127.0.0.1:9200/索引名称/类型名称/_delete_by_query?refresh&slices=5&pretty" -H 'Content-Type: application/json' -d'
+{
+ "query": {
+ "match_all": {}
+ }
+}
+'
+```
+
+
+
+
+-------------------------------------------------------------------------------------------------------------------
+
+## Elasticsearch 5.2.0 安装
+
+- 官网下载地址:
+- Elasticsearch 5.2.0 版本下载地址(32M):
+
+
+### 环境
+
+- 机子 IP:192.168.1.127
+- CentOS 7.3
+- JDK 版本:1.8(最低要求),主推:JDK 1.8.0_121 以上
+- Elasticsearch 版本:5.2.0
+- 关闭 firewall
+ - `systemctl stop firewalld.service` #停止firewall
+ - `systemctl disable firewalld.service` #禁止firewall开机启动
+
+
+### zip 解压安装
+
+- 官网总的安装文档:
+- 我的解压目录:`/usr/program`,解压包名:`elasticsearch-5.2.0.zip`
+- 解压:`cd /usr/program ; unzip elasticsearch-5.2.0.zip`
+- 删除掉压缩包:`rm -rf elasticsearch-5.2.0.zip`
+- 添加组和用户
+ - 该版本不能使用 root 用户进行使用
+ - `useradd elasticsearch -p 123456`,添加一个名为 elasticsearch 的用户,还有一个同名的组
+- 添加数据目录:`mkdir -p /opt/elasticsearch/data /opt/elasticsearch/log`
+- 赋权限:
+ - `chown -R elasticsearch:elasticsearch /usr/program/elasticsearch-5.2.0 /opt/elasticsearch`
+- 编辑配置文件:`vim /usr/program/elasticsearch-5.2.0/config/elasticsearch.yml`,打开下面注释,并修改
+
+``` nginx
+cluster.name: youmeek-cluster
+node.name: youmeek-node-1
+path.data: /opt/elasticsearch/data
+path.logs: /opt/elasticsearch/log
+bootstrap.memory_lock: true
+network.host: 0.0.0.0 # 也可以是本机 IP
+http.port: 9200
+discovery.zen.ping.unicast.hosts: ["192.168.1.127"] #如果有多个机子集群,这里就写上这些机子的 IP,格式:["192.168.1.127","192.168.1.126"]
+```
+
+- 重点说明:Elasticsearch 的集群环境,主要就是上面这段配置文件内容的差别。如果有其他机子:node.name、discovery.zen.ping.unicast.hosts 需要改下。集群中所有机子的配置文件中 discovery.zen.ping.unicast.hosts 都要有所有机子的 IP 地址。
+- 修改这个配置文件,不然无法锁内存:`vim /etc/security/limits.conf`
+- 在文件最尾部增加下面内容:
+
+``` nginx
+# allow user 'elasticsearch' mlockall
+elasticsearch soft memlock unlimited
+elasticsearch hard memlock unlimited
+* soft nofile 262144
+* hard nofile 262144
+```
+
+- 修改:`vim /etc/sysctl.conf`,添加下面配置
+
+``` ini
+vm.max_map_count=262144
+```
+
+- 重启机子:`reboot`。
+- 切换用户:`su elasticsearch`
+- 控制台运行(启动比较慢):`cd /usr/program/elasticsearch-5.2.0 ; ./bin/elasticsearch`
+- 后台运行:`cd /usr/program/elasticsearch-5.2.0 ; ./bin/elasticsearch -d -p 自定义pid值`
+- 在本机终端输入该命令:`curl -XGET 'http://192.168.1.127:9200'`,(也可以用浏览器访问:)如果能得到如下结果,则表示启动成功:
+
+``` json
+{
+ "name" : "youmeek-node-1",
+ "cluster_name" : "youmeek-cluster",
+ "cluster_uuid" : "c8RxQdOHQJq-Tg8rrPi_UA",
+ "version" : {
+ "number" : "5.2.0",
+ "build_hash" : "24e05b9",
+ "build_date" : "2017-01-24T19:52:35.800Z",
+ "build_snapshot" : false,
+ "lucene_version" : "6.4.0"
+ },
+ "tagline" : "You Know, for Search"
+}
+```
+
+## 安装 Kibana 5.2.0
+
+- 官网下载地址:
+- Kibana 5.2.0 版本下载地址(36M):
+- Kibana 5.2.0 官网文档:
+- Kibana 5.2.0 官网安装文档:
+
+### tar.gz 解压安装
+
+- 安装目录:/usr/program
+- 解压:`cd /usr/program ; tar zxvf kibana-5.2.0-linux-x86_64.tar.gz`
+- 删除压缩包:`rm -rf kibana-5.2.0-linux-x86_64.tar.gz`
+- 修改解压后的目录名称:`mv kibana-5.2.0-linux-x86_64 kibana-5.2.0`
+- 修改配置:`vim /usr/program/kibana-5.2.0/config/kibana.yml`,默认配置都是注释的,我们这里打开这些注释:
+
+``` nginx
+server.port: 5601
+server.host: "0.0.0.0" # 请将这里改为 0.0.0.0 或是当前本机 IP,不然可能会访问不了
+erver.name: "youmeek-kibana"
+elasticsearch.url: "http://192.168.1.127:9200"
+elasticsearch.username: "elasticsearch"
+elasticsearch.password: "123456"
+```
+
+- 运行:`cd /usr/program/kibana-5.2.0 ; ./bin/kibana`
+- 浏览器访问:,可以看到 Kibana `Configure an index pattern` 界面
+- 访问 Dev Tools 工具,后面写 DSL 语句会常使用该功能:
+
+
+## Beats
+
+### Beats 资料
+
+- Beats 官网:
+- Beats 简单介绍:日志数据搜集器。一般安装在需要收集日志的服务器上,然后把收集的数据发送到 Elasticsearch 或是先发送到 logstash 清洗整理(解析过滤)后再发送到 Elasticsearch。
+ - logstash 也有收集日志的功能,只是它相对 Beats 更加消耗 CPU 和内存,所以一般使用 Beats 收集日志。
+- 目前常见的 Beats 类型:
+ - Filebeat(搜集文件数据);
+ - Packetbeat(搜集网络流量数据);
+ - Metricbeat(搜集系统、进程和文件系统级别的 CPU 和内存使用情况等数据);
+ - Winlogbeat(搜集 Windows 事件日志数据)。
+ - Heartbeat(主动探测服务是否可用)。
+
+## 安装 X-Pack 或是其他插件
+
+- X-Pack 是官网提供的管理增强工具,但是全部功能收费,有一个月使用,有部分功能免费。其他免费的插件。
+ - licence 的用法可以看这篇文章:
+ -
+ -
+ - 破解:
+ - 免费插件:
+ - head - 节点数据查看管理:
+ - kopf - 集群管理:
+- 官网说明:
+- 安装(过程比较慢):`/usr/share/elasticsearch/bin/elasticsearch-plugin install x-pack`
+- 如果线上安装速度太慢,那就离线安装:
+ - 下载,我放在 /opt 目录下(119M):`wget https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-5.2.2.zip`
+ - 安装:`/usr/share/elasticsearch/bin/elasticsearch-plugin install file:///opt/x-pack-5.2.2.zip`
+- 卸载:`/usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack`
+- 安装后重启服务,重启后访问你会发现需要用户和密码,我们可以关掉这个,在 elasticsearch.yml 中添加:`xpack.security.enabled: false`
+- 其他 5.2 资料:
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+
+-------------------------------------------------------------------------------------------------------------------
+
+
+## 2.4.X
+
+### 安装 elasticsearch 集群
+
+### 下载
+
+- 下载在我个人习惯的子自己创建的目录下:/usr/program/elk
+- elasticsearch 2.4.1(26 M):`wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.4.1.tar.gz`
+- logstash 2.4.0(80 M):`wget https://download.elastic.co/logstash/logstash/logstash-2.4.1.tar.gz`
+- kibana 4.6.1(32 M):`wget https://download.elastic.co/kibana/kibana/kibana-4.6.1-linux-x86_64.tar.gz`
+
+### tar 解压安装
+
+- **确保系统安装有 JDK**
+- 官网文档:
+- 添加日志存放目录、数据存放目录:`mkdir -p /opt/elasticsearch/data /opt/elasticsearch/log`
+- 添加组和用户
+ - 该版本不能使用 root 用户进行使用
+ - `useradd elasticsearch -p 123456`,添加一个名为 elasticsearch 的用户,还有一个同名的组
+- 解压下载的文件
+ - `cd /usr/program/elk`
+ - `tar zxvf elasticsearch-2.4.1.tar.gz`
+- 赋权限:
+ - `chown -R elasticsearch:elasticsearch /usr/program/elk /opt/elasticsearch`
+- 我 tar 安装后一些路径说明:
+ - home:`/usr/program/elk/elasticsearch-2.4.1`
+ - bin:`/usr/program/elk/elasticsearch-2.4.1/bin`
+ - 配置文件:`/usr/program/elk/elasticsearch-2.4.1/config/elasticsearch.yml`
+ - plugins:`/usr/program/elk/elasticsearch-2.4.1/plugins`
+ - script:`/usr/program/elk/elasticsearch-2.4.1/scripts`
+ - data:`/opt/elasticsearch/data`
+ - log:`/opt/elasticsearch/log/集群名称.log`
+- 编辑配置文件:`vim /usr/program/elk/elasticsearch-2.4.1/config/elasticsearch.yml`,打开下面注释,并修改
+
+``` nginx
+cluster.name: gitnavi-cluster
+node.name: gitnavi-node-1
+path.data: /opt/elasticsearch/data
+path.logs: /opt/elasticsearch/log
+bootstrap.memory_lock: true
+network.host: 0.0.0.0 # 也可以是本机 IP
+http.port: 9200
+discovery.zen.ping.multicast.enabled: false
+discovery.zen.ping.unicast.hosts: ["192.168.1.127", "192.168.1.126"] #这个为两台机子的 IP 地址
+```
+
+- 修改这个配置文件,不然无法锁内存:`vim /etc/security/limits.conf`
+- 在文件最尾部增加下面内容:
+
+``` nginx
+# allow user 'elasticsearch' mlockall
+elasticsearch soft memlock unlimited
+elasticsearch hard memlock unlimited
+* soft nofile 262144
+* hard nofile 262144
+```
+
+- 关闭 firewall
+ - `systemctl stop firewalld.service` #停止firewall
+ - `systemctl disable firewalld.service` #禁止firewall开机启动
+
+- 切换到 elasticsearch 用户下:`su elasticsearch`
+- 带控制台的启动(比较慢):`/usr/program/elk/elasticsearch-2.4.1/bin/elasticsearch`
+ - 控制台会输出类似这样的信息:
+
+```
+[2017-03-13 18:42:51,170][INFO ][node ] [gitnavi-node-1] version[2.4.1], pid[21156], build[c67dc32/2016-09-27T18:57:55Z]
+[2017-03-13 18:42:51,177][INFO ][node ] [gitnavi-node-1] initializing ...
+[2017-03-13 18:42:51,821][INFO ][plugins ] [gitnavi-node-1] modules [reindex, lang-expression, lang-groovy], plugins [head, kopf], sites [head, kopf]
+[2017-03-13 18:42:51,852][INFO ][env ] [gitnavi-node-1] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [12.4gb], net total_space [17.4gb], spins? [unknown], types [rootfs]
+[2017-03-13 18:42:51,852][INFO ][env ] [gitnavi-node-1] heap size [1015.6mb], compressed ordinary object pointers [true]
+[2017-03-13 18:42:54,094][INFO ][node ] [gitnavi-node-1] initialized
+[2017-03-13 18:42:54,094][INFO ][node ] [gitnavi-node-1] starting ...
+[2017-03-13 18:42:54,175][INFO ][transport ] [gitnavi-node-1] publish_address {192.168.1.127:9300}, bound_addresses {[::]:9300}
+[2017-03-13 18:42:54,178][INFO ][discovery ] [gitnavi-node-1] gitnavi-cluster/-XywT60EScO-9lgzjfnsgg
+[2017-03-13 18:42:57,344][INFO ][cluster.service ] [gitnavi-node-1] new_master {gitnavi-node-1}{-XywT60EScO-9lgzjfnsgg}{192.168.1.127}{192.168.1.127:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
+[2017-03-13 18:42:57,410][INFO ][gateway ] [gitnavi-node-1] recovered [0] indices into cluster_state
+[2017-03-13 18:42:57,414][INFO ][http ] [gitnavi-node-1] publish_address {192.168.1.127:9200}, bound_addresses {[::]:9200}
+[2017-03-13 18:42:57,414][INFO ][node ] [gitnavi-node-1] started
+```
+
+- 守护进程方式启动:`/usr/program/elk/elasticsearch-2.4.1/bin/elasticsearch -d`
+- 守护进程方式停止:`ps -ef|grep elasticsearc`,只能通过 kill pid 来结束
+- 访问:`http://192.168.1.127:9200/`,可以看到如下内容:
+
+``` json
+{
+ "name" : "gitnavi-node-1",
+ "cluster_name" : "gitnavi-cluster",
+ "cluster_uuid" : "0b66dYpnTd-hh7x4Phfm1A",
+ "version" : {
+ "number" : "2.4.1",
+ "build_hash" : "c67dc32e24162035d18d6fe1e952c4cbcbe79d16",
+ "build_timestamp" : "2016-09-27T18:57:55Z",
+ "build_snapshot" : false,
+ "lucene_version" : "5.5.2"
+ },
+ "tagline" : "You Know, for Search"
+}
+```
+
+- 插件(插件的迭代很容易跟不上官网的版本,所以请牢记关注插件官网的说明)
+ - head,节点数据查看管理:
+ - kopf,集群管理:
+ - Bigdesk,监控查看CPU内存索引数据搜索情况http连接数:
+- 安装(过程比较慢)
+ - head:`/usr/program/elk/elasticsearch-2.4.1/bin/plugin install mobz/elasticsearch-head`
+ - 安装完的访问地址:`http://192.168.1.127:9200/_plugin/head`
+ - kopf:`/usr/program/elk/elasticsearch-2.4.1/bin/plugin install lmenezes/elasticsearch-kopf`
+ - 安装完的访问地址:`http://192.168.1.127:9200/_plugin/kopf`
+ - Bigdesk:`/usr/program/elk/elasticsearch-2.4.1/bin/plugin install hlstudio/bigdesk`
+ - 安装完的访问地址:`http://192.168.1.127:9200/_plugin/bigdesk`
+ - 卸载:`/usr/share/elasticsearch/bin/elasticsearch-plugin remove 插件名称`
+- IK 分词插件的安装(**重点:所有节点都需要安装此插件**)
+ - IK 分词官网:
+ - 官网首页已经有一个表格说明 ES 版本和 IK 插件的版本对应,我们可以看到:ES 2.4.1 对应 IK 分词 1.10.1,下载地址:
+ - 进入 ES 插件目录:`cd /usr/program/elk/elasticsearch-2.4.1/plugins`
+ - 创建 ik 目录:`mkdir ik`
+ - 把下载的 elasticsearch-analysis-ik-1.10.1.zip 上传到刚新建的 ik 目录下
+ - 解压:`unzip elasticsearch-analysis-ik-1.10.1.zip`
+ - 删除压缩包:`rm -rf elasticsearch-analysis-ik-1.10.1.zip`
+ - 编辑 ES 配置文件:`vim /usr/program/elk/elasticsearch-2.4.1/config/elasticsearch.yml`
+ - 在文件底部添加如下内容:
+
+``` ini
+index.analysis.analyzer.default.tokenizer : "ik_max_word"
+index.analysis.analyzer.default.type: "ik"
+```
+
+- 重启 ES : /usr/program/elk/elasticsearch-2.4.1/bin/elasticsearch
+- 验证 ik 插件,浏览器访问:,能得到如下结果就表示成功:
+
+``` json
+[
+ {
+ "token": "这是",
+ "start_offset": 0,
+ "end_offset": 2,
+ "type": "CN_WORD",
+ "position": 0
+ },
+ {
+ "token": "一个",
+ "start_offset": 2,
+ "end_offset": 4,
+ "type": "CN_WORD",
+ "position": 1
+ },
+ {
+ "token": "一",
+ "start_offset": 2,
+ "end_offset": 3,
+ "type": "TYPE_CNUM",
+ "position": 2
+ },
+ {
+ "token": "个",
+ "start_offset": 3,
+ "end_offset": 4,
+ "type": "COUNT",
+ "position": 3
+ },
+ {
+ "token": "针对",
+ "start_offset": 4,
+ "end_offset": 6,
+ "type": "CN_WORD",
+ "position": 4
+ },
+ {
+ "token": "程序员",
+ "start_offset": 6,
+ "end_offset": 9,
+ "type": "CN_WORD",
+ "position": 5
+ },
+ {
+ "token": "程序",
+ "start_offset": 6,
+ "end_offset": 8,
+ "type": "CN_WORD",
+ "position": 6
+ },
+ {
+ "token": "序",
+ "start_offset": 7,
+ "end_offset": 8,
+ "type": "CN_WORD",
+ "position": 7
+ },
+ {
+ "token": "员",
+ "start_offset": 8,
+ "end_offset": 9,
+ "type": "CN_CHAR",
+ "position": 8
+ },
+ {
+ "token": "优化",
+ "start_offset": 9,
+ "end_offset": 11,
+ "type": "CN_WORD",
+ "position": 9
+ },
+ {
+ "token": "导航",
+ "start_offset": 12,
+ "end_offset": 14,
+ "type": "CN_WORD",
+ "position": 10
+ },
+ {
+ "token": "航",
+ "start_offset": 13,
+ "end_offset": 14,
+ "type": "CN_WORD",
+ "position": 11
+ },
+ {
+ "token": "gitnavi.com",
+ "start_offset": 14,
+ "end_offset": 25,
+ "type": "LETTER",
+ "position": 12
+ },
+ {
+ "token": "gitnavi",
+ "start_offset": 14,
+ "end_offset": 21,
+ "type": "ENGLISH",
+ "position": 13
+ },
+ {
+ "token": "com",
+ "start_offset": 22,
+ "end_offset": 25,
+ "type": "ENGLISH",
+ "position": 14
+ }
+]
+```
+
+- Elasticsearch 5.x 版本之后,就不需要再修改这个配置文件了 `/usr/program/elk/elasticsearch-2.4.1/config/elasticsearch.yml`,直接解压 zip 后,直接可以启动使用。可以访问这个进行测试:
+- 其他一些配置文件:
+ - main.dic,内置中文词库文件是,差不多有 27W 条记录。
+ - stopword.dic,英文停用词,一般不会被分词,不会存放在倒排索引中。
+ - quantifier.dic,用来存放一些量词。
+ - suffix.dic,用来存放后缀词。
+ - surname.dic,姓氏。
+- 自定义分词词库:
+ - 修改配置文件:IKAnalyzer.cfg.xml
+ - 在 ext_dict 标签中指定我们自己新增的 dic 文件(给的 demo 路径是 custom 目录下)。
+ - 修改完重启下 Elasticsearch 集群
+- 自定义停用词库:
+ - 修改配置文件:IKAnalyzer.cfg.xml
+ - 在 ext_stopwords 标签中指定我们自己新增的 dic 文件(给的 demo 路径是 custom 目录下)。
+ - 修改完重启下 Elasticsearch 集群
+
+
+### 构建 elasticsearch 集群
+
+- 另外一台机子也同样这样安装,但是有几个地方有差别:
+ - 特别注意:集群的关键点是配置文件中的:cluster.name,这个一样就表示在一个集群中
+ - 配置文件:`/usr/program/elk/elasticsearch-2.4.1/config/elasticsearch.yml`
+ - node 名称改为不一样的,比如我这边改为 2:node.name: gitnavi-node-2
+ - 插件不用安装,有一台机子安装即可
+ - 先启动装有 head 的机子,然后再启动另外一台,这样好辨别
+
+
+
+## 资料
+
+- <>
+- <>
\ No newline at end of file
diff --git a/FTP.md b/markdown-file/FTP.md
similarity index 99%
rename from FTP.md
rename to markdown-file/FTP.md
index 51dc097a..53fb9149 100644
--- a/FTP.md
+++ b/markdown-file/FTP.md
@@ -52,7 +52,7 @@
## vsftpd 的两种传输模式
- 分为:主动模式(PORT)和被动模式(PASV)。这两个模式会涉及到一些端口问题,也就涉及到防火墙问题,所以要特别注意。主动模式比较简单,只要在防火墙上放开放开 21 和 20 端口即可。被动模式则要根据情况放开一个端口段。
- - 
+ - 
- 上图箭头:xftp 新建连接默认都是勾选被动模式的,所以如果要使用主动模式,在该连接的属性中是要去掉勾选。
## vsftpd 的两种运行模式
diff --git a/FastDFS-Install-And-Settings.md b/markdown-file/FastDFS-Install-And-Settings.md
similarity index 97%
rename from FastDFS-Install-And-Settings.md
rename to markdown-file/FastDFS-Install-And-Settings.md
index cb6133c5..52412272 100644
--- a/FastDFS-Install-And-Settings.md
+++ b/markdown-file/FastDFS-Install-And-Settings.md
@@ -1,32 +1,19 @@
# FastDFS 安装和配置
-## 它是什么
+## FastDFS 介绍
- FastDFS 介绍:
- 官网下载 1:
- 官网下载 2:
- 官网下载 3:
-
-## 为什么会出现
-
-
-
-## 哪些人喜欢它
-
-
-## 哪些人不喜欢它
-
-
-
-## 为什么学习它
-
-
-
-
-## 同类工具
-
-
+- 主要场景:
+ - 小图片
+ - 音频、小视频
+ - 其他类型小文件
+- 更加复杂的文件存储场景可以选择:[Ceph](https://ceph.com/)
+ - 支持对象存储、块存储和文件存储
+ - 高性能、高可靠性和高扩展
### 单机安装部署(CentOS 6.7 环境)
@@ -212,7 +199,7 @@
```
- 在终端中通过 shell 上传 opt 目录下的一张图片:`/usr/bin/fdfs_test /etc/fdfs/client.conf upload /opt/test.jpg`
- 如下图箭头所示,生成的图片地址为:`http://192.168.1.114/group1/M00/00/00/wKgBclb0aqWAbVNrAAAjn7_h9gM813_big.jpg`
- - 
+ - 
- 即使我们现在知道图片的访问地址我们也访问不了,因为我们还没装 FastDFS 的 Nginx 模块
- 安装 **fastdfs-nginx-module_v1.16.tar.gz**,安装 Nginx 第三方模块相当于这个 Nginx 都是要重新安装一遍的
- 解压 Nginx 模块:`tar zxvf fastdfs-nginx-module_v1.16.tar.gz`,得到目录地址:**/opt/setups/FastDFS/fastdfs-nginx-module**
diff --git a/FastDFS-Nginx-Lua-GraphicsMagick.md b/markdown-file/FastDFS-Nginx-Lua-GraphicsMagick.md
similarity index 99%
rename from FastDFS-Nginx-Lua-GraphicsMagick.md
rename to markdown-file/FastDFS-Nginx-Lua-GraphicsMagick.md
index 4bca747d..3e051a4f 100644
--- a/FastDFS-Nginx-Lua-GraphicsMagick.md
+++ b/markdown-file/FastDFS-Nginx-Lua-GraphicsMagick.md
@@ -181,7 +181,7 @@
```
- 在终端中通过 shell 上传 opt 目录下的一张图片:`/usr/bin/fdfs_test /etc/fdfs/client.conf upload /opt/test.jpg`
- 如下图箭头所示,生成的图片地址为:`http://192.168.1.114/group1/M00/00/00/wKgBclb0aqWAbVNrAAAjn7_h9gM813_big.jpg`
- - 
+ - 
- 即使我们现在知道图片的访问地址我们也访问不了,因为我们还没装 FastDFS 的 Nginx 模块
diff --git a/File-Extract-Compress.md b/markdown-file/File-Extract-Compress.md
similarity index 59%
rename from File-Extract-Compress.md
rename to markdown-file/File-Extract-Compress.md
index 14afe6ad..fd03c1dd 100644
--- a/File-Extract-Compress.md
+++ b/markdown-file/File-Extract-Compress.md
@@ -1,7 +1,11 @@
# Linux 下常用压缩文件的解压、压缩
-## 常用压缩包**解压**命令整理
+## 常用压缩包--解压--令整理
+
+- Linux 后缀为 `.war` 格式的文件(一般用在部署 Tomcat 项目的时候)
+- 命令:`unzip -oq XXXXXX.war -d ROOT`
+ - 如果没有 ROOT 目录会自动创建 ROOT 目录。
- Linux 后缀为 `.tar.gz` 格式的文件-解压
- 命令:`tar zxvf XXXXXX.tar.gz`
@@ -29,10 +33,15 @@
- 命令:`tar xf XXXXXX.tar.xz`
+
-----------------------------------------------------------
-## 常用文件进行**压缩**命令整理
+## 常用文件进行--压缩--命令整理
+
+- Linux 压缩文件夹为后缀 `.war` 格式的文件(最好不要对根目录进行压缩,不然会多出一级目录)
+- 命令:`jar -cvfM0 cas.war /opt/cas/META-INF /opt/cas/WEB-INF /opt/cas/index.jsp`
+- 或者命令:`cd 项目根目录 ; jar -cvfM0 cas.war ./*`
- Linux 压缩文件为后缀 `.tar` 格式的文件
- 命令:`tar -zcvf test11.tar test11`
@@ -53,6 +62,20 @@
- 命令:`7za a test1.7z /opt/test1/`
+## 分卷压缩
+
+- 分卷压缩:`zip -s 100M myFile.zip --out newFile.zip`
+- 最终效果:
+
+```
+newFile.z01
+newFile.z02
+newFile.z03
+newFile.z04
+newFile.zip
+```
+
+
## 特殊格式
- 7z
@@ -70,6 +93,20 @@
- 安装:`make install`
- rar 解压:`rar x 文件名.rar`
+## jar 包操作
+
+### 修改 jar 包配置文件
+
+- 命令:`vim mytest.jar`,这时候会展示 jar 中所有层级目录下的所有文件
+- 输入:`/log4j2.xml` 回车,光标定位到该文件,然后再回车,进入编辑该文件状态
+- 此时可以修改配置文件了,修改后 `:wq` 保存退出,接着 `:q` 退出 jar 编辑状态
+
+### 更新 Jar 包中的文件
+
+- 替换(新增)jar 根目录下的文件:`jar uvf mytest.jar ClassToAdd.class`
+- 一般 class 文件都是在多层目录里面的,需要这样做:`jar uvf mytest.jar com/youmeek/ClassToAdd.class`
+ - 需要在 jar 所在的文件夹下创建:`mkdir -p ./com/youmeek`,该目录必须和原 jar 里面的层级目录结构一致
+
## 资料
diff --git a/markdown-file/Flink-Install-And-Settings.md b/markdown-file/Flink-Install-And-Settings.md
new file mode 100644
index 00000000..97d813c0
--- /dev/null
+++ b/markdown-file/Flink-Install-And-Settings.md
@@ -0,0 +1,371 @@
+# Flink 安装和配置
+
+## 介绍
+
+- 2018-11-30 发布最新:1.7.0 版本
+- 官网:
+- 官网 Github:
+
+## 本地模式安装
+
+- CentOS 7.4
+- IP 地址:`192.168.0.105`
+- 官网指导:
+- 必须 JDK 8.x
+- 下载:
+ - 选择 Binaries 类型
+ - 如果没有 Hadoop 环境,只是本地开发,选择:Apache 1.7.0 Flink only
+ - Scala 2.11 和 Scala 2.12 都可以,但是我因为后面要用到 kafka,kafka 推荐 Scala 2.11,所以我这里也选择同样。
+ - 最终我选择了:Apache 1.7.0 Flink only Scala 2.11,共:240M
+- 解压:`tar zxf flink-*.tgz`
+- 进入根目录:`cd flink-1.7.0`,完整路径:`cd /usr/local/flink-1.7.0`
+- 改下目录名方便后面书写:`mv /usr/local/flink-1.7.0 /usr/local/flink`
+- 启动:`cd /usr/local/flink && ./bin/start-cluster.sh`
+- 停止:`cd /usr/local/flink && ./bin/stop-cluster.sh`
+- 查看日志:`tail -300f log/flink-*-standalonesession-*.log`
+- 浏览器访问 WEB 管理:`http://192.168.0.105:8081`
+
+## yarn 启动
+
+- 安装方式跟上面一样,但是必须保证有 hadoop、yarn 集群
+- 控制台启动:`cd /usr/local/flink && ./bin/yarn-session.sh -n 2 -jm 1024 -tm 1024`
+- 守护进程启动:`cd /usr/local/flink && ./bin/yarn-session.sh -n 2 -jm 1024 -tm 1024 -d`
+- 有可能会报:`The Flink Yarn cluster has failed`,可能是资源不够
+- YARN 参数配置可以参考:[点击我](https://sustcoder.github.io/2018/09/27/YARN%20%E5%86%85%E5%AD%98%E5%8F%82%E6%95%B0%E8%AF%A6%E8%A7%A3/)
+
+## Demo
+
+- 运行程序解压包下也有一些 jar demo:`cd /usr/local/flink/examples`
+- 官网:
+- DataStream API:
+- DataSet API:
+- 访问该脚本可以得到如下内容:
+
+```
+mvn archetype:generate \
+ -DarchetypeGroupId=org.apache.flink \
+ -DarchetypeArtifactId=flink-quickstart-java \
+ -DarchetypeVersion=${1:-1.7.0} \
+ -DgroupId=org.myorg.quickstart \
+ -DartifactId=$PACKAGE \
+ -Dversion=0.1 \
+ -Dpackage=org.myorg.quickstart \
+ -DinteractiveMode=false
+```
+
+- 可以自己在本地执行该 mvn 命令,用 Maven 骨架快速创建一个 WordCount 项目
+- 注意,这里必须使用这个仓库(最好用穿越软件):`https://repository.apache.org/content/repositories/snapshots`
+- 该骨架的所有版本:
+ - 根据实验,目前 1.7.0 和 1.6.x 都是没有 WordCount demo 代码的。但是 1.3.x 是有的。
+
+## 运行
+
+- 可以直接在 IntelliJ IDEA 上 run
+- 也可以交给服务器上 flink 执行,也有两种方式:
+ - 把 jar 自己上传 Flink 服务器运行:`cd /usr/local/flink && ./bin/flink run -c com.youmeek.WordCount /opt/flink-simple-demo-1.0-SNAPSHOT.jar`
+ - 也可以通过 WEB UI 上传 jar:
+ - 有一个 `Add New` 按钮可以上传 jar 包,然后填写 Class 路径:`com.youmeek.WordCount`
+ - `parallelism` 表示并行度,填写数字,一般并行度设置为集群 CPU 核数总和的 2-3 倍(如果是单机模式不需要设置并行度)
+
+## 安装 ncat 方便发送数据包
+
+- 环境:CentOS 7.4
+- 官网下载:,找到 rpm 包
+- 当前时间(201803)最新版本下载:`wget https://nmap.org/dist/ncat-7.60-1.x86_64.rpm`
+- 当前时间(201812)最新版本下载:`wget https://nmap.org/dist/ncat-7.70-1.x86_64.rpm`
+- 安装:`sudo rpm -i ncat-7.60-1.x86_64.rpm`
+- ln 下:`sudo ln -s /usr/bin/ncat /usr/bin/nc`
+- 检验:`nc --version`
+- 启动监听 9011 端口:`nc -lk 9011`,然后你可以输入内容,Flink demo 看是否有收到
+
+-------------------------------------------------------------------
+
+
+## Flink 核心概念
+
+- 四个基石:Checkpoint、State、Time、Window
+- 解决 exactly-once 的问题
+- 实现了 watermark 的机制,解决了基于事件时间处理时的数据乱序和数据迟到的问题
+- 状态管理
+- 提供了一套开箱即用的窗口操作,包括滚动窗口、滑动窗口、会话窗口
+- 我想说的,都被这篇文章说了:
+ -
+ -
+- 这里补充点其他的
+
+
+```
+Client 用来提交任务给 JobManager,JobManager 分发任务给 TaskManager 去执行,然后 TaskManager 会心跳的汇报任务状态
+在 Flink 集群中,计算资源被定义为 Task Slot
+每个 TaskManager 会拥有一个或多个 Slots
+
+JobManager 会以 Slot 为单位调度 Task。
+对 Flink 的 JobManager 来说,其调度的是一个 Pipeline 的 Task,而不是一个点。
+在 Flink 中其也是一个被整体调度的 Pipeline Task。在 TaskManager 中,根据其所拥有的 Slot 个数,同时会拥有多个 Pipeline
+
+
+Task Slot
+在架构概览中我们介绍了 TaskManager 是一个 JVM 进程,并会以独立的线程来执行一个task或多个subtask。为了控制一个 TaskManager 能接受多少个 task,Flink 提出了 Task Slot 的概念。
+
+Flink 中的计算资源通过 Task Slot 来定义。每个 task slot 代表了 TaskManager 的一个固定大小的资源子集。例如,一个拥有3个slot的 TaskManager,会将其管理的内存平均分成三分分给各个 slot。将资源 slot 化意味着来自不同job的task不会为了内存而竞争,而是每个task都拥有一定数量的内存储备。需要注意的是,这里不会涉及到CPU的隔离,slot目前仅仅用来隔离task的内存。
+通过调整 task slot 的数量,用户可以定义task之间是如何相互隔离的。每个 TaskManager 有一个slot,也就意味着每个task运行在独立的 JVM 中。每个 TaskManager 有多个slot的话,也就是说多个task运行在同一个JVM中。而在同一个JVM进程中的task,可以共享TCP连接(基于多路复用)和心跳消息,可以减少数据的网络传输。也能共享一些数据结构,一定程度上减少了每个task的消耗。
+
+每一个 TaskManager 会拥有一个或多个的 task slot,每个 slot 都能跑由多个连续 task 组成的一个 pipeline,比如 MapFunction 的第n个并行实例和 ReduceFunction 的第n个并行实例可以组成一个 pipeline。
+
+source(Streaming 进来)
+Transformations(Streaming 处理)
+sink(Streaming 出去)
+
+Flink程序与生俱来的就是并行和分布式的。Streams被分割成stream patition, Operators被被分割成operator subtasks。这些subtasks在不同的机器(容器)上的不同的线程中运行,彼此独立,互不干扰。 一个操作的operator subtask的数目,被称为parallelism(并行度)。一个stream的并行度,总是等于生成它的(operator)操作的并行度。一个Flink程序中,不同的operator可能具有不同的并行度。
+```
+
+-------------------------------------------------------------------
+
+
+#### 为了容错的 Checkpoint 机制
+
+- 这几篇文章写得很好:
+ - [Flink 增量式checkpoint 介绍](https://my.oschina.net/u/992559/blog/2873828)
+ - [A Deep Dive into Rescalable State in Apache Flink](https://flink.apache.org/features/2017/07/04/flink-rescalable-state.html)
+ - [Flink 小贴士 (5): Savepoint 和 Checkpoint 的 3 个不同点](http://wuchong.me/blog/2018/11/25/flink-tips-differences-between-savepoints-and-checkpoints/)
+ - [Flink 小贴士 (2):Flink 如何管理 Kafka 消费位点](http://wuchong.me/blog/2018/11/04/how-apache-flink-manages-kafka-consumer-offsets/)
+- Checkpoint 允许 Flink 恢复流中的状态和位置,使应用程序具有与无故障执行相同的语义
+- Checkpoint 是 Flink 用来从故障中恢复的机制,快照下了整个应用程序的状态,当然也包括输入源读取到的位点。如果发生故障,Flink 将通过从 Checkpoint 加载应用程序状态并从恢复的读取位点继续应用程序的处理,就像什么事情都没发生一样。
+
+
+```
+一个checkpoint是Flink的一致性快照,它包括:
+
+程序当前的状态
+输入流的位置
+Flink通过一个可配置的时间,周期性的生成checkpoint,将它写入到存储中,例如S3或者HDFS。写入到存储的过程是异步的,意味着Flink程序在checkpoint运行的同时还可以处理数据。
+
+在机器或者程序遇到错误重启的时候,Flink程序会使用最新的checkpoint进行恢复。Flink会恢复程序的状态,将输入流回滚到checkpoint保存的位置,然后重新开始运行。这意味着Flink可以像没有发生错误一样计算结果。
+
+检查点(Checkpoint)是使 Apache Flink 能从故障恢复的一种内部机制。检查点是 Flink 应用状态的一个一致性副本,包括了输入的读取位点。在发生故障时,Flink 通过从检查点加载应用程序状态来恢复,并从恢复的读取位点继续处理,就好像什么事情都没发生一样。你可以把检查点想象成电脑游戏的存档一样。如果你在游戏中发生了什么事情,你可以随时读档重来一次。
+检查点使得 Apache Flink 具有容错能力,并确保了即时发生故障也能保证流应用程序的语义。检查点是以固定的间隔来触发的,该间隔可以在应用中配置。
+
+```
+
+- 默认情况下 checkpoint 是不启用的,为了启用 checkpoint,需要在 StreamExecutionEnvironment 中调用 enableCheckpointing(n) 方法, 其中 n 是 checkpoint 的间隔毫秒数。
+- 这里有一个核心:用到 Facebook 的 RocksDB 数据库(可嵌入式的支持持久化的 key-value 存储系统)
+
+
+-------------------------------------------------------------------
+
+#### Exactly-Once
+
+- 因为有了 Checkpoint,才有了 Exactly-Once
+- [Apache Flink 端到端(end-to-end)Exactly-Once特性概览 (翻译)](https://my.oschina.net/u/992559/blog/1819948)
+- 常见有这几种语义:
+
+```
+at most once : 至多一次。可能导致消息丢失。
+at least once : 至少一次。可能导致消息重复。
+exactly once : 刚好一次。不丢失也不重复。
+```
+
+
+-------------------------------------------------------------------
+
+
+#### Watermark
+
+- [Flink 小贴士 (3): 轻松理解 Watermark](http://wuchong.me/blog/2018/11/18/flink-tips-watermarks-in-apache-flink-made-easy/)
+- 了解事件时间的几个概念:event-time【消息产生的时间】, processing-time【消息处理时间】, ingestion-time【消息流入 flink 框架的时间】
+- watermark 的作用,他们定义了何时不再等待更早的数据
+- WaterMark 只在时间特性 EventTime 和 IngestionTime 起作用,并且 IngestionTime 的时间等同于消息的 ingestion 时间
+
+-------------------------------------------------------------------
+
+#### 窗口
+
+-
+- [Flink 原理与实现:Window 机制](http://wuchong.me/blog/2016/05/25/flink-internals-window-mechanism/)
+- [Flink 原理与实现:Session Window](http://wuchong.me/blog/2016/06/06/flink-internals-session-window/)
+
+##### 滚动窗口(Tumbling Windows)
+
+- 滚动窗口有一个固定的大小,并且不会出现重叠
+
+###### 滚动事件时间窗口
+
+```
+input
+ .keyBy()
+ .window(TumblingEventTimeWindows.of(Time.seconds(5)))
+ .