基于hadoop-2.7.5的集群搭建

hadoop-2.7.5
hive-2.3.2
jdk1.8.0_152
mysql-5.7.21

1.集群规划
集群节点分配
主机名主机IP
master192.168.100.100
slave1192.168.100.101
slave2192.168.100.102
slave3192.168.100.103
软件版本
软件名称版本号
Java1.8.0_152
CentOSCentOS-7-x64-1708
Hadoop2.7.5
MySQL5.7.20
Hive2.3.2
各软件安装路径
Hadoop/opt/SoftWare/Hadoop/
Java/opt/SoftWare/Java/
Hive/opt/SoftWare/Hive
MySQL/opt/SoftWare/MySQL
2.各主机基础软件安装及操作
    由于使用的是最小化安装,因此这里需要安装不少软件才能进行后续操作
    2.1 openssh安装,便于远程上传文件
1
[root@master ~]# yum -y install openssh-clients
<!DOCTYPE HTML><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>05-Hadoop集群+Hive+MySQL搭建</title>
    
<style id="wiz_code_style">.wiz-code-container{position: relative; padding:8px 0; margin: 5px 25px 5px 5px;text-indent:0; text-align:left;}.CodeMirror {font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; color: black; font-size: 10pt; font-size: 0.83rem}.CodeMirror-lines {padding: 4px 0;}.CodeMirror pre {padding: 0 4px;}.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {background-color: white;}.CodeMirror-gutters {border-right: 1px solid #ddd; background-color: #f7f7f7; white-space: nowrap;}.CodeMirror-linenumbers {}.CodeMirror-linenumber {padding: 0 3px 0 5px; min-width: 20px; text-align: right; color: #999; white-space: nowrap;}.CodeMirror-guttermarker {color: black;}.CodeMirror-guttermarker-subtle {color: #999;}.CodeMirror-cursor {border-left: 1px solid black; border-right: none; width: 0;}.CodeMirror div.CodeMirror-secondarycursor {border-left: 1px solid silver;}.cm-fat-cursor .CodeMirror-cursor {width: auto; border: 0 !important; background: #7e7;}.cm-fat-cursor div.CodeMirror-cursors {z-index: 1;}.cm-animate-fat-cursor {width: auto; border: 0; -webkit-animation: blink 1.06s steps(1) infinite; -moz-animation: blink 1.06s steps(1) infinite; animation: blink 1.06s steps(1) infinite; background-color: #7e7;}@-moz-keyframes blink {  0% {}  50% { background-color: transparent; }  100% {}}@-webkit-keyframes blink {  0% {}  50% { background-color: transparent; }  100% {}}@keyframes blink {  0% {}  50% { background-color: transparent; }  100% {}}.CodeMirror-overwrite .CodeMirror-cursor {}.cm-tab { display: inline-block; text-decoration: inherit; }.CodeMirror-rulers {position: absolute; left: 0; right: 0; top: -50px; bottom: -20px; overflow: hidden;}.CodeMirror-ruler {border-left: 1px solid #ccc; top: 0; bottom: 0; position: absolute;}.cm-s-default .cm-header {color: blue;}.cm-s-default .cm-quote {color: #090;}.cm-negative {color: #d44;}.cm-positive {color: #292;}.cm-header, .cm-strong {font-weight: bold;}.cm-em {font-style: italic;}.cm-link {text-decoration: underline;}.cm-strikethrough {text-decoration: line-through;}.cm-s-default .cm-keyword {color: #708;}.cm-s-default .cm-atom {color: #219;}.cm-s-default .cm-number {color: #164;}.cm-s-default .cm-def {color: #00f;}.cm-s-default .cm-variable,.cm-s-default .cm-punctuation,.cm-s-default .cm-property,.cm-s-default .cm-operator {}.cm-s-default .cm-variable-2 {color: #05a;}.cm-s-default .cm-variable-3 {color: #085;}.cm-s-default .cm-comment {color: #a50;}.cm-s-default .cm-string {color: #a11;}.cm-s-default .cm-string-2 {color: #f50;}.cm-s-default .cm-meta {color: #555;}.cm-s-default .cm-qualifier {color: #555;}.cm-s-default .cm-builtin {color: #30a;}.cm-s-default .cm-bracket {color: #997;}.cm-s-default .cm-tag {color: #170;}.cm-s-default .cm-attribute {color: #00c;}.cm-s-default .cm-hr {color: #999;}.cm-s-default .cm-link {color: #00c;}.cm-s-default .cm-error {color: #f00;}.cm-invalidchar {color: #f00;}.CodeMirror-composing { border-bottom: 2px solid; }div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }.CodeMirror-activeline-background {background: #e8f2ff;}.CodeMirror {position: relative; background: #f5f5f5;}.CodeMirror-scroll {overflow: hidden !important; margin-bottom: 0; margin-right: -30px; padding: 16px 30px 16px 0; outline: none; position: relative;}.CodeMirror-sizer {position: relative; border-right: 30px solid transparent;}.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {position: absolute; z-index: 6; display: none;}.CodeMirror-vscrollbar {right: 0; top: 0; overflow-x: hidden; overflow-y: scroll;}.CodeMirror-hscrollbar {bottom: 0; left: 0 !important; overflow-y: hidden; overflow-x: scroll;}.CodeMirror-scrollbar-filler {right: 0; bottom: 0;}.CodeMirror-gutter-filler {left: 0; bottom: 0;}.CodeMirror-gutters {position: absolute; left: 0; top: -5px; min-height: 100%; z-index: 3;}.CodeMirror-gutter {white-space: normal; height: inherit; display: inline-block; vertical-align: top; margin-bottom: -30px;}.CodeMirror-gutter-wrapper {position: absolute; z-index: 4; background: none !important; border: none !important;}.CodeMirror-gutter-background {position: absolute; top: 0; bottom: 0; z-index: 4;}.CodeMirror-gutter-elt {position: absolute; cursor: default; z-index: 4; text-align: center;}.CodeMirror-gutter-wrapper ::selection { background-color: transparent }.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }.CodeMirror-lines {cursor: text; min-height: 1px;}.CodeMirror pre {-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; border-width: 0; background: transparent; font-family: inherit; font-size: inherit; margin: 0; white-space: pre; word-wrap: normal; line-height: inherit; color: inherit; z-index: 2; position: relative; overflow: visible; -webkit-tap-highlight-color: transparent; -webkit-font-variant-ligatures: contextual; font-variant-ligatures: contextual;}.CodeMirror-wrap pre {word-wrap: break-word; white-space: pre-wrap; word-break: normal;}.CodeMirror-linebackground {position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 0;}.CodeMirror-linewidget {position: relative; z-index: 2; overflow: auto;}.CodeMirror-widget {}.CodeMirror-rtl pre { direction: rtl; }.CodeMirror-code {outline: none;}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber {-moz-box-sizing: content-box; box-sizing: content-box;}.CodeMirror-measure {position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;}.CodeMirror-cursor {position: absolute; pointer-events: none;}.CodeMirror-measure pre { position: static; }div.CodeMirror-cursors {visibility: hidden; position: relative; z-index: 3;}div.CodeMirror-dragcursors {visibility: visible;}.CodeMirror-focused div.CodeMirror-cursors {visibility: visible;}.CodeMirror-selected { background: #d9d9d9; }.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }.CodeMirror-crosshair { cursor: crosshair; }.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }.cm-searching {background: #ffa; background: rgba(255, 255, 0, .4);}.cm-force-border { padding-right: .1px; }@media print {  .CodeMirror div.CodeMirror-cursors {visibility: hidden;}}.cm-tab-wrap-hack:after { content: ""; }span.CodeMirror-selectedtext { background: none; }.CodeMirror-activeline-background, .CodeMirror-selected {transition: visibility 0ms 100ms;}.CodeMirror-blur .CodeMirror-activeline-background, .CodeMirror-blur .CodeMirror-selected {visibility:hidden;}.CodeMirror-blur .CodeMirror-matchingbracket {color:inherit !important;outline:none !important;text-decoration:none !important;}</style><style name="wiz_code_style" id="wiz_code_style-base16-light">.cm-s-base16-light.CodeMirror { background: #f5f5f5; color: #202020; }.cm-s-base16-light div.CodeMirror-selected { background: #e0e0e0; }.cm-s-base16-light .CodeMirror-line::selection, .cm-s-base16-light .CodeMirror-line > span::selection, .cm-s-base16-light .CodeMirror-line > span > span::selection { background: #e0e0e0; }.cm-s-base16-light .CodeMirror-line::-moz-selection, .cm-s-base16-light .CodeMirror-line > span::-moz-selection, .cm-s-base16-light .CodeMirror-line > span > span::-moz-selection { background: #e0e0e0; }.cm-s-base16-light .CodeMirror-gutters { background: #f5f5f5; border-right: 0px; }.cm-s-base16-light .CodeMirror-guttermarker { color: #ac4142; }.cm-s-base16-light .CodeMirror-guttermarker-subtle { color: #b0b0b0; }.cm-s-base16-light .CodeMirror-linenumber { color: #b0b0b0; }.cm-s-base16-light .CodeMirror-cursor { border-left: 1px solid #505050; }.cm-s-base16-light span.cm-comment { color: #8f5536; }.cm-s-base16-light span.cm-atom { color: #aa759f; }.cm-s-base16-light span.cm-number { color: #aa759f; }.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute { color: #90a959; }.cm-s-base16-light span.cm-keyword { color: #ac4142; }.cm-s-base16-light span.cm-string { color: #f4bf75; }.cm-s-base16-light span.cm-variable { color: #90a959; }.cm-s-base16-light span.cm-variable-2 { color: #6a9fb5; }.cm-s-base16-light span.cm-def { color: #d28445; }.cm-s-base16-light span.cm-bracket { color: #202020; }.cm-s-base16-light span.cm-tag { color: #ac4142; }.cm-s-base16-light span.cm-link { color: #aa759f; }.cm-s-base16-light span.cm-error { background: #ac4142; color: #505050; }.cm-s-base16-light .CodeMirror-activeline-background { background: #DDDCDC; }.cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }</style><style id="wiz_custom_css">html, .wiz-editor-body {font-size: 12pt;}.wiz-editor-body {font-family: Helvetica, 'Hiragino Sans GB', '寰蒋闆呴粦', 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;line-height: 1.6;margin: 0 auto;padding: 20px 16px;padding: 1.25rem 1rem;}.wiz-editor-body h1,.wiz-editor-body h2,.wiz-editor-body h3,.wiz-editor-body h4,.wiz-editor-body h5,.wiz-editor-body h6 {margin:20px 0 10px;margin:1.25rem 0 0.625rem;padding: 0;font-weight: bold;}.wiz-editor-body h1 {font-size:20pt;font-size:1.67rem;}.wiz-editor-body h2 {font-size:18pt;font-size:1.5rem;}.wiz-editor-body h3 {font-size:15pt;font-size:1.25rem;}.wiz-editor-body h4 {font-size:14pt;font-size:1.17rem;}.wiz-editor-body h5 {font-size:12pt;font-size:1rem;}.wiz-editor-body h6 {font-size:12pt;font-size:1rem;color: #777777;margin: 1rem 0;}.wiz-editor-body div,.wiz-editor-body p,.wiz-editor-body ul,.wiz-editor-body ol,.wiz-editor-body dl,.wiz-editor-body li {margin:0;}.wiz-editor-body blockquote,.wiz-editor-body table,.wiz-editor-body pre,.wiz-editor-body code {margin:8px 0;}.wiz-editor-body .CodeMirror pre {margin:0;}.wiz-editor-body ul,.wiz-editor-body ol {padding-left:32px;padding-left:2rem;}.wiz-editor-body ol.wiz-list-level1 > li {list-style-type:decimal;}.wiz-editor-body ol.wiz-list-level2 > li {list-style-type:lower-latin;}.wiz-editor-body ol.wiz-list-level3 > li {list-style-type:lower-roman;}.wiz-editor-body blockquote {padding:0 12px;padding:0 0.75rem;}.wiz-editor-body blockquote > :first-child {margin-top:0;}.wiz-editor-body blockquote > :last-child {margin-bottom:0;}.wiz-editor-body img {border:0;max-width:100%;height:auto !important;margin:2px 0;}.wiz-editor-body table {border-collapse:collapse;border:1px solid #bbbbbb;}.wiz-editor-body td,.wiz-editor-body th {padding:4px 8px;border-collapse:collapse;border:1px solid #bbbbbb;min-height:28px;word-break:break-all;box-sizing: border-box;}.wiz-hide {display:none !important;}</style></head>

<body class="wiz-editor-body wiz-editing" spellcheck="false" style="opacity: 1;" ><div><span data-wiz-span="data-wiz-span" style="font-size: 1.333rem;"><b><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.5rem;">1.集群规划</span></b></span></div><div class="wiz-table-container" style="position: relative; padding: 0px;"><div class="wiz-table-body"><table style="width: 703px;"><tbody><tr><td align="left" valign="middle" style="width: 703px; background-color: rgb(238, 238, 238);" class="" rowspan="1" colspan="2"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">集群节点分配</span></td></tr><tr><td align="left" valign="middle" style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">主机名</span></td><td align="left" valign="middle" style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">主机IP</span></td></tr><tr><td align="left" valign="middle" style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">master</span></td><td align="left" valign="middle" style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">192.168.100.100</span></td></tr><tr><td align="left" valign="middle" style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">slave1</span></td><td align="left" valign="middle" style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">192.168.100.101</span></td></tr><tr><td align="left" valign="middle" style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">slave2</span></td><td align="left" valign="middle" style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">192.168.100.102</span></td></tr><tr><td align="left" valign="middle" style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">slave3</span></td><td align="left" valign="middle" style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">192.168.100.103</span></td></tr><tr><td align="left" valign="middle" style="width: 703px; background-color: rgb(238, 238, 238);" class="" rowspan="1" colspan="2"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">软件版本</span></td></tr><tr><td class="" style="width: 240px;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">软件名称</span></td><td class="" style="width: 463px;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">版本号</span></td></tr><tr><td style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">Java</span></td><td style="width: 463px;" class=""><span style="color:rgb(0, 0, 0);font-family:Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size:1rem;font-style:normal;font-weight:normal;text-align:-webkit-left;text-indent:0px;display:inline !important;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">1.8.0_152</span></span><br></td></tr><tr><td style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">CentOS</span></td><td style="width: 463px;" class=""><span style="color:rgb(0, 0, 0);font-family:Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size:1rem;font-style:normal;font-weight:normal;text-align:-webkit-left;text-indent:0px;display:inline !important;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">CentOS-7-x64-1708</span></span><br></td></tr><tr><td style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">Hadoop</span></td><td style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">2.7.5</span></td></tr><tr><td class="" style="width: 240px;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">MySQL</span></td><td style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">5.7.20</span></td></tr><tr><td style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">Hive</span></td><td style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">2.3.2</span></td></tr><tr><td class="" style="width: 240px; background-color: rgb(238, 238, 238);" rowspan="1" colspan="2"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">各软件安装路径</span></td></tr><tr><td style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">Hadoop</span></td><td style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">/opt/SoftWare/Hadoop/</span></td></tr><tr><td style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">Java</span></td><td style="width: 463px;" class=""><span style="color:rgb(0, 0, 0);font-family:Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size:1rem;font-style:normal;font-weight:normal;text-align:start;text-indent:0px;display:inline !important;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">/opt/SoftWare/Java/</span></span><br></td></tr><tr><td class="" style="width: 240px;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">Hive</span></td><td style="width: 463px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">/opt/SoftWare/Hive</span></td></tr><tr><td style="width: 240px;" class=""><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">MySQL</span></td><td style="width: 463px;" class=""><span style="color:rgb(0, 0, 0);font-family:Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif;font-size:1rem;font-style:normal;font-weight:normal;text-align:start;text-indent:0px;display:inline !important;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">/opt/SoftWare/MySQL</span></span><br></td></tr></tbody></table></div></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.333rem;"><b><span data-wiz-span="data-wiz-span" style="font-size: 1.5rem;">2.各主机基础软件安装及操作</span></b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    由于使用的是最小化安装,因此这里需要安装不少软件才能进行后续操作</span><br></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    <b>2.1 openssh安装,便于远程上传文件</b></span><br></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355141_8429" class="wiz-code-container"><textarea style="display: none;">[root@master ~]# yum -y install openssh-clients</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323488_3092"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># yum -y install openssh-clients</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 59px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">2.2 同步时间工具</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355139_4115" class="wiz-code-container"><textarea style="display: none;">#安装ntpdate工具
[root@master ~]# yum -y install ntp ntpdate
#设置与网络时间同步
[root@master ~]# ntpdate cn.pool.ntp.org
#系统时间写入硬件时间
[root@master ~]# hwclock --systohc</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323456_5366"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 134px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>6</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>6</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#安装ntpdate工具</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># yum -y install ntp ntpdate</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#设置与网络时间同步</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># ntpdate cn.pool.ntp.org</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#系统时间写入硬件时间</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># hwclock --systohc</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 134px;"></div><div class="CodeMirror-gutters" style="height: 164px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">2.3 文件上传(rz)下载(sz)工具</span></b></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">   <span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;"> </span></span><span style="color: inherit; font-family: 楷体; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">可以在Xshell工具中通过rz调出上传文件的窗口进行文件上传,也可以通过sz 文件名下载某一个文件</span></span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355136_9832" class="wiz-code-container"><textarea style="display: none;">[root@master ~]# yum -y install lrzsz</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323430_5301"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># yum -y install lrzsz</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 59px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="line-height: 1.6;">    </span><span style="line-height: 1.6;">    </span><b style="line-height: 1.6; font-family: 楷体;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">2.4 安装网络下载工具 wget</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355131_4003" class="wiz-code-container"><textarea style="display: none;">[root@test ~]# yum -y install wget</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323403_5121"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@test ~]<span class="cm-comment"># yum -y install wget</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 59px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="line-height: 1.6;">    </span><span style="line-height: 1.6;">    </span><b style="font-family: 楷体; font-size: 1.167rem; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">2.4 关闭防火墙</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355127_5732" class="wiz-code-container"><textarea style="display: none;">#查看防火墙开启状态
[root@test ~]# systemctl status firewalld
#关闭防火墙
[root@test ~]# systemctl stop firewalld
#禁止开机启动防火墙
[root@test ~]# systemctl disable firewalld
#开启防火墙
[root@test ~]# systemctl start firewalld
#设置开机启动防火墙
[root@test ~]# systemctl enable firewalld
#重启防火墙
[root@test ~]# systemctl restart firewalld</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323360_3186"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 260px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>12</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>12</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#查看防火墙开启状态</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@test ~]<span class="cm-comment"># systemctl status firewalld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#关闭防火墙</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@test ~]<span class="cm-comment"># systemctl stop firewalld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#禁止开机启动防火墙</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@test ~]<span class="cm-comment"># systemctl disable firewalld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#开启防火墙</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@test ~]<span class="cm-comment"># systemctl start firewalld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#设置开机启动防火墙</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@test ~]<span class="cm-comment"># systemctl enable firewalld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#重启防火墙</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@test ~]<span class="cm-comment"># systemctl restart firewalld</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 260px;"></div><div class="CodeMirror-gutters" style="height: 290px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><b><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.5rem;">3. 配置SSH免密码登录</span></b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">3.1 四台主机均按照步骤2安装基础软件工具(这里不再过多叙述)</span></b></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-size: 1.5rem; line-height: 38.4px; font-family: 楷体; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">3.2 修改hosts文件,添加以下内容,四台主机均进行操作</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355124_1168" class="wiz-code-container"><textarea style="display: none;">[root@master ~]# vi /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.100 master
192.168.100.101 slave1
192.168.100.102 slave2
192.168.100.103 slave3</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323321_5029"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 155px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>7</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>7</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># vi /etc/hosts</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.100.100 master</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.100.101 slave1</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.100.102 slave2</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">192</span>.168.100.103 slave3</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 155px;"></div><div class="CodeMirror-gutters" style="height: 185px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-size: 1.5rem; line-height: 38.4px; font-family: 楷体; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">3.3 配置SSH免密码登录</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355120_1538" class="wiz-code-container"><textarea style="display: none;">#每台机器先使用ssh执行以下,以在主目录产生一个.ssh 文件夹
[root@master ~]# ssh master
#然后输入no即可
#每台机器均进入~/.ssh 目录进行操作
[root@master ~]# cd ~/.ssh
#输入以下命令,一路回车,用以产生公钥和秘钥
[root@master .ssh]# ssh-keygen -t rsa -P ''
#出现以下信息说明生成成功
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:6YO1h1emM9gcWvv9OT6ftHxLnjP9u8p25x1o30oq3No root@master
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|                 |
|                 |
|         .       |
|        S o o    |
|       + O *  .  |
|      . B.X. o.+.|
|         +o=+=**%|
|          .oEo*^^|
+----[SHA256]-----+
#将每台机器上的id_rsa.pub公钥内容复制到authorized_keys文件中
[root@master .ssh]# cp id_rsa.pub authorized_keys
#将所有的authorized_keys文件进行合并(最简单的方法是将其余三台slave主机的文件内容追加到master主机上)
[root@slave1 .ssh]# cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'
[root@slave2 .ssh]# cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'
[root@slave3 .ssh]# cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'
#查看master上的authorized_keys文件内容,类似如下即可
[root@master .ssh]# more authorized_keys 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5iw8+LlLxo0d77uaTChOKKJqfMHzp2jgzqV2hFAneFXqqWmr
Z4/FrMUPenmdss19bP4Up9G7PGbJu29yZDvkDwlmuqnVajYyDOsCl7PPXPWXMIlxMGUHgSXLnQQi6QnWp04vJKD
s0EbiRTd0ZYCSQefzJcZ8jbQ7bLYt6jtil7FfUupTdHTeexKKd8Mq3K7YFZHumKvhzs6wWiM+n41jANS083ss3O
YmAdO2cU0w1BhLVvJhdzd6fNG3RXVCXI2v0XxCUHiqI9Oewl2qPOfKzeyy09bJxo371Ezjmt8GMrkA/Ecepkvx1
2qwNzC9bSPLfbnPWVo2gIxe4mMaFqCFJ root@master
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3CkB3Jejavt+yFphsbciktWciJmbcUBOv3ZLPVLW18ZxXGZK
vG50EPXo/4By7P6IRW0wCa5YuckQEW+q6kmSatxqJ8e/K9a1mAk13N4f7V7M71Nn8IkujlF3gHYjKrmnEWpGJCy
5YBURzywIQTRArlIac1xj2SeM6q+gTMV9WrAKJupIRHli+W0kHVaYHNdKl7KMUT4KVrSl+h4wFwAd7Tcyj7JIbU
cCCL6o/v/LqGFwpcJfbfUsuKJJho+tImh41j7mSXR8kRbTSZkcq5KX+iANrANwOHZ58tV5KXmMQjuVq7aJ985C1
6hHssB6zq/zjAxpxAyQIeE8Incc8U8ix root@slave1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC//uaMbzbkYqxdgZJSdq+gdQYldzMQ7D3SxsUaNO5oVnVOszw
+mbNnmL8vp1EUUehabQHPCAvCmLKUPXzfcxlyJEF/pnY77u4ySwsRVEpHvsDZbrclgCOrS6hW00sSx303KHLOgX
T70LfrmnohfUhvTxajzLXT+C8f5ZfTZ8meKD73HKl16jRwZQ8YhW9GUyuCkgQTGtKtTKPsRUd9LpAc/7/u8xvvv
NvTYPxgyTJcUMzGSOHh8J3upI54ykY0FgBkjs1fCUaDalxAgsHw9B1iyx706WbcT6ymiQVMKGnnnM6k2KPvUvfD
0swVfUSG+4ZsYSRHRTgWuiBbHoIr7DVd root@slave2
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDTzTTdGRTd1zts3m7uKobcgRom4lVyF9EdNOdbBWMucYjbCs
BgP1ideDDQed2TyBj3Szz3Yx6h1L4McGmATY/D9qRLml26VW/x0Tod8JYkqOQpQL9knLW2cwITnhLzq5VDugOix
06r/uweP3Zed9CO7ld3jUxJJNZCYpsNz+eUKq9SWM5+ehUu9pfZZu9zUk7Q01js3uCHzu1AhsajgNzgB4+YLLcc
dHBfxGg4ix5wuaF82PlEEh70hTdfRkq8pqPMZ+FIQtTgfD5XllKTcnPItUY23hc7Umx4I3ujOd810vzffWYK07c
Otv1r7LEcYtYqbZ6zIvII+M775iRkzQX root@slave3
#将master上的authorized_keys文件分发到其他主机上
[root@master .ssh]# scp ~/.ssh/authorized_keys root@slave1:~/.ssh/
[root@master .ssh]# scp ~/.ssh/authorized_keys root@slave2:~/.ssh/
[root@master .ssh]# scp ~/.ssh/authorized_keys root@slave3:~/.ssh/
#每台机器之间进行ssh免密码登录操作,包括自己与自己
[root@master ~]# ssh master
[root@master ~]# ssh slave1
[root@slave1 ~]# ssh master
[root@master ~]# ssh slave2
[root@slave2 ~]# ssh master
[root@master ~]# ssh slave3
[root@slave3 ~]# ssh master
[root@master ~]# ssh slave1
[root@slave1 ~]# ssh slave1
[root@slave1 ~]# ssh slave2
[root@slave2 ~]# ssh slave1
[root@slave1 ~]# ssh slave3
[root@slave3 ~]# ssh slave1
[root@slave1 ~]# ssh slave2
[root@slave2 ~]# ssh slave2
[root@slave2 ~]# ssh slave3
[root@slave3 ~]# ssh slave2
[root@slave2 ~]# ssh slave3
[root@slave3 ~]# ssh slave2
[root@slave2 ~]# ssh slave3
[root@slave3 ~]# ssh slave3</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323149_8176"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 1511px; left: 230px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 1688px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors" style="visibility: hidden;"><div class="CodeMirror-cursor" style="left: 201px; top: 1491px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="" style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#每台机器先使用ssh执行以下,以在主目录产生一个.ssh 文件夹</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># ssh master</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#然后输入no即可</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#每台机器均进入~/.ssh 目录进行操作</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># cd ~/.ssh</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#输入以下命令,一路回车,用以产生公钥和秘钥</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master .ssh]<span class="cm-comment"># ssh-keygen -t rsa -P ''</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#出现以下信息说明生成成功</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Generating public/private rsa key pair.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Enter file <span class="cm-keyword">in</span> which to save the key (/root/.ssh/id_rsa): </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Your identification has been saved <span class="cm-keyword">in</span> /root/.ssh/id_rsa.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Your public key has been saved <span class="cm-keyword">in</span> /root/.ssh/id_rsa.pub.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">The key fingerprint is:</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">SHA256:6YO1h1emM9gcWvv9OT6ftHxLnjP9u8p25x1o30oq3No root@master</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">The key<span class="cm-string">'s randomart image is:</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">+</span><span class="cm-attribute">---</span>[RSA <span class="cm-number">2048</span>]----<span class="cm-operator">+</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|                 |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|                 |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|                 |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|         .       |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|        S o o    |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">22</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|       <span class="cm-operator">+</span> O *  .  |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">23</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|      . B.X. o.<span class="cm-operator">+</span>.|</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">24</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|         <span class="cm-operator">+</span><span class="cm-def">o</span><span class="cm-operator">=+=</span>**%|</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">25</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">|          .oEo*^^|</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">26</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">+</span><span class="cm-attribute">----</span>[SHA256]-----<span class="cm-operator">+</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">27</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#将每台机器上的id_rsa.pub公钥内容复制到authorized_keys文件中</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">28</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master .ssh]<span class="cm-comment"># cp id_rsa.pub authorized_keys</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">29</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#将所有的authorized_keys文件进行合并(最简单的方法是将其余三台slave主机的文件内容追加到master主机上)</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">30</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave1 .ssh]<span class="cm-comment"># cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">31</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave2 .ssh]<span class="cm-comment"># cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">32</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave3 .ssh]<span class="cm-comment"># cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">33</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#查看master上的authorized_keys文件内容,类似如下即可</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">34</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master .ssh]<span class="cm-comment"># more authorized_keys </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">35</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5iw8<span class="cm-operator">+</span>LlLxo0d77uaTChOKKJqfMHzp2jgzqV2hFAneFXqqWmr</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">36</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Z4/FrMUPenmdss19bP4Up9G7PGbJu29yZDvkDwlmuqnVajYyDOsCl7PPXPWXMIlxMGUHgSXLnQQi6QnWp04vJKD</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">37</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">s0EbiRTd0ZYCSQefzJcZ8jbQ7bLYt6jtil7FfUupTdHTeexKKd8Mq3K7YFZHumKvhzs6wWiM<span class="cm-operator">+</span>n41jANS083ss3O</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">38</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">YmAdO2cU0w1BhLVvJhdzd6fNG3RXVCXI2v0XxCUHiqI9Oewl2qPOfKzeyy09bJxo371Ezjmt8GMrkA/Ecepkvx1</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">39</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">2qwNzC9bSPLfbnPWVo2gIxe4mMaFqCFJ root@master</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">40</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3CkB3Jejavt<span class="cm-operator">+</span>yFphsbciktWciJmbcUBOv3ZLPVLW18ZxXGZK</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">41</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">vG50EPXo/4By7P6IRW0wCa5YuckQEW<span class="cm-operator">+</span>q6kmSatxqJ8e/K9a1mAk13N4f7V7M71Nn8IkujlF3gHYjKrmnEWpGJCy</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">42</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">5YBURzywIQTRArlIac1xj2SeM6q<span class="cm-operator">+</span>gTMV9WrAKJupIRHli<span class="cm-operator">+</span>W0kHVaYHNdKl7KMUT4KVrSl<span class="cm-operator">+</span>h4wFwAd7Tcyj7JIbU</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">43</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">cCCL6o/v/LqGFwpcJfbfUsuKJJho<span class="cm-operator">+</span>tImh41j7mSXR8kRbTSZkcq5KX<span class="cm-operator">+</span>iANrANwOHZ58tV5KXmMQjuVq7aJ985C1</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">44</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">6hHssB6zq/zjAxpxAyQIeE8Incc8U8ix root@slave1</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">45</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC//uaMbzbkYqxdgZJSdq<span class="cm-operator">+</span>gdQYldzMQ7D3SxsUaNO5oVnVOszw</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">46</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">+</span>mbNnmL8vp1EUUehabQHPCAvCmLKUPXzfcxlyJEF/pnY77u4ySwsRVEpHvsDZbrclgCOrS6hW00sSx303KHLOgX</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">47</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">T70LfrmnohfUhvTxajzLXT<span class="cm-operator">+</span>C8f5ZfTZ8meKD73HKl16jRwZQ8YhW9GUyuCkgQTGtKtTKPsRUd9LpAc/7/u8xvvv</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">48</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NvTYPxgyTJcUMzGSOHh8J3upI54ykY0FgBkjs1fCUaDalxAgsHw9B1iyx706WbcT6ymiQVMKGnnnM6k2KPvUvfD</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">49</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">0swVfUSG<span class="cm-operator">+</span>4ZsYSRHRTgWuiBbHoIr7DVd root@slave2</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">50</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDTzTTdGRTd1zts3m7uKobcgRom4lVyF9EdNOdbBWMucYjbCs</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">51</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">BgP1ideDDQed2TyBj3Szz3Yx6h1L4McGmATY/D9qRLml26VW/x0Tod8JYkqOQpQL9knLW2cwITnhLzq5VDugOix</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">52</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">06r/uweP3Zed9CO7ld3jUxJJNZCYpsNz<span class="cm-operator">+</span>eUKq9SWM5<span class="cm-operator">+</span>ehUu9pfZZu9zUk7Q01js3uCHzu1AhsajgNzgB4<span class="cm-operator">+</span>YLLcc</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">53</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">dHBfxGg4ix5wuaF82PlEEh70hTdfRkq8pqPMZ<span class="cm-operator">+</span>FIQtTgfD5XllKTcnPItUY23hc7Umx4I3ujOd810vzffWYK07c</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">54</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Otv1r7LEcYtYqbZ6zIvII<span class="cm-operator">+</span>M775iRkzQX root@slave3</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">55</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#将master上的authorized_keys文件分发到其他主机上</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">56</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master .ssh]<span class="cm-comment"># scp ~/.ssh/authorized_keys root@slave1:~/.ssh/</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">57</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master .ssh]<span class="cm-comment"># scp ~/.ssh/authorized_keys root@slave2:~/.ssh/</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">58</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master .ssh]<span class="cm-comment"># scp ~/.ssh/authorized_keys root@slave3:~/.ssh/</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">59</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#每台机器之间进行ssh免密码登录操作,包括自己与自己</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">60</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># ssh master</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">61</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># ssh slave1</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">62</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave1 ~]<span class="cm-comment"># ssh master</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">63</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># ssh slave2</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">64</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave2 ~]<span class="cm-comment"># ssh master</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">65</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># ssh slave3</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">66</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave3 ~]<span class="cm-comment"># ssh master</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">67</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># ssh slave1</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">68</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave1 ~]<span class="cm-comment"># ssh slave1</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">69</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave1 ~]<span class="cm-comment"># ssh slave2</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">70</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave2 ~]<span class="cm-comment"># ssh slave1</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">71</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave1 ~]<span class="cm-comment"># ssh slave3</span></span></pre></div><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">72</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave3 ~]<span class="cm-comment"># ssh slave1</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">73</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave1 ~]<span class="cm-comment"># ssh slave2</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">74</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave2 ~]<span class="cm-comment"># ssh slave2</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">75</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave2 ~]<span class="cm-comment"># ssh slave3</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">76</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave3 ~]<span class="cm-comment"># ssh slave2</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">77</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave2 ~]<span class="cm-comment"># ssh slave3</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">78</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave3 ~]<span class="cm-comment"># ssh slave2</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">79</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave2 ~]<span class="cm-comment"># ssh slave3</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">80</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave3 ~]<span class="cm-comment"># ssh slave3</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 1688px;"></div><div class="CodeMirror-gutters" style="height: 1718px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><b><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.5rem;">4. 安装配置Java环境并测试</span></b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">   <span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;"> <span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><b>4.1 下载jdk</b></span></span></span></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; font-size: 1.167rem; line-height: 29.8752px;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">下载地址:</span></span><a href="http://www.oracle.com/technetwork/java/javase/archive-139210.html" style="font-size: 1.167rem; line-height: 29.8752px;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">http://www.oracle.com/technetwork/java/javase/archive-139210.html</span></a><span style="color: inherit; font-size: 1.167rem; line-height: 29.8752px;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;"> </span></span></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="color: inherit; line-height: 1.6; font-family: 楷体;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">4.2 卸载其他jdk</span></b></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">   <b> </b></span><span style="font-family: 楷体; color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">如果centos中已经安装的有jdk,则需要先卸载当前jdk,重新安装新的jdk</span></span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355117_552" class="wiz-code-container"><textarea style="display: none;">#查询当前所有安装的jdk版本
[root@master ~]# rpm -qa|grep jdk
#如果什么都没有展示说明没有已安装的jdk,则无需卸载,如果出现以下jdk,则卸载之
copy-jdk-configs-2.2-3.el7.noarch
java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64
#卸载jdk,使用下面的方法卸载即可
[root@master ~]# yum -y remove copy-jdk-configs-2.2-3.el7.noarch
#再次查询当前所有安装的jdk版本
[root@master ~]# rpm -qa|grep jdk</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323105_5815"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 218px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>10</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>10</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#查询当前所有安装的jdk版本</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># rpm -qa|grep jdk</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#如果什么都没有展示说明没有已安装的jdk,则无需卸载,如果出现以下jdk,则卸载之</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">copy-jdk-configs-2.2-3.el7.noarch</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#卸载jdk,使用下面的方法卸载即可</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># yum -y remove copy-jdk-configs-2.2-3.el7.noarch</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#再次查询当前所有安装的jdk版本</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># rpm -qa|grep jdk</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 218px;"></div><div class="CodeMirror-gutters" style="height: 248px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">4.3 开始安装jdk</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355113_5294" class="wiz-code-container"><textarea style="display: none;">#在master主节点上创建指定目录
[root@master ~]# mkdir -p /opt/SoftWare/Java
[root@master ~]# mkdir -p /opt/SoftWare/Hadoop
#进入到Java目录
[root@master ~]# cd /opt/SoftWare/Java
#使用rz命令从windows主机上传jdk压缩包到master节点
[root@master Java]# rz
#解压到当前目录
[root@master Java]# tar -zxvf jdk-8u152-linux-x64.tar.gz 
#配置环境变量
[root@master Java]# vi /etc/profile
#在该文件后面追加一下内容
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152
export JRE_HOME=/opt/SoftWare/Java/jdk1.8.0_152/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
#使刚才的设置生效
[root@master Java]# source /etc/profile
#检测是否配置成功
[root@master Java]# java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
#其他主机同样的操作进行即可</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177323036_5073"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 512px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>24</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>24</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#在master主节点上创建指定目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># mkdir -p /opt/SoftWare/Java</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># mkdir -p /opt/SoftWare/Hadoop</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#进入到Java目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># cd /opt/SoftWare/Java</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#使用rz命令从windows主机上传jdk压缩包到master节点</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Java]<span class="cm-comment"># rz</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#解压到当前目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Java]<span class="cm-comment"># tar -zxvf jdk-8u152-linux-x64.tar.gz </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#配置环境变量</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Java]<span class="cm-comment"># vi /etc/profile</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#在该文件后面追加一下内容</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">JAVA_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Java/jdk1.8.0_152</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">JRE_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Java/jdk1.8.0_152/jre</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">CLASSPATH</span><span class="cm-operator">=</span>.:<span class="cm-def">$JAVA_HOME</span>/lib/dt.jar:<span class="cm-def">$JAVA_HOME</span>/lib/tools.jar:<span class="cm-def">$JRE_HOME</span>/lib/rt.jar</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">PATH</span><span class="cm-operator">=</span><span class="cm-def">$PATH</span>:<span class="cm-def">$JAVA_HOME</span>/bin:<span class="cm-def">$JRE_HOME</span>/bin</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#使刚才的设置生效</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Java]<span class="cm-comment"># source /etc/profile</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#检测是否配置成功</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Java]<span class="cm-comment"># java -version</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">java version <span class="cm-string">"1.8.0_152"</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">22</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Java(TM) SE Runtime Environment (build <span class="cm-number">1</span>.8.0_152-b16)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">23</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Java HotSpot(TM) <span class="cm-number">64</span><span class="cm-attribute">-Bit</span> Server VM (build <span class="cm-number">25</span>.152-b16, mixed mode)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">24</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#其他主机同样的操作进行即可</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 512px;"></div><div class="CodeMirror-gutters" style="height: 542px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><b><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.5rem;">5. 安装配置Hadoop并配置</span></b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family:楷体;font-size:1.5rem"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; font-size: 1rem; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; font-size: 1.5rem; color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.1 下载Hadoop到本地</span></b></div><div><span data-wiz-span="data-wiz-span" style="color:inherit;font-family:楷体;font-size:1.167rem">    下载地址:</span><font face="楷体"><span style="font-size: 1.5rem; line-height: 38.4px;"></span></font><font face="楷体"><span style="line-height: 38.4px;"><a href="http://hadoop.apache.org/releases.html"><span data-wiz-span="data-wiz-span" style="color:inherit;font-family:楷体;font-size:1.167rem">http://hadoop.apache.org/releases.html</span></a></span></font><font face="楷体"><span style="font-size: 1.5rem; line-height: 38.4px;"> </span></font></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-size: 1.5rem; line-height: 38.4px; font-family: 楷体; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.2 上传至master节点</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355109_8954" class="wiz-code-container"><textarea style="display: none;">#上传
[root@master ~]# cd /opt/SoftWare/Hadoop
[root@master Hadoop]# rz
#解压
[root@master Hadoop]# tar -zxvf hadoop-2.7.5.tar.gz</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322996_892"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 113px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>5</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>5</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#上传</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># cd /opt/SoftWare/Hadoop</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hadoop]<span class="cm-comment"># rz</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#解压</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hadoop]<span class="cm-comment"># tar -zxvf hadoop-2.7.5.tar.gz</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 113px;"></div><div class="CodeMirror-gutters" style="height: 143px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-size: 1.5rem; line-height: 38.4px; font-family: 楷体; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.3 创建目录</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355105_4859" class="wiz-code-container"><textarea style="display: none;">#进入hadoop-2.7.5主目录
[root@master Hadoop]# cd hadoop-2.7.5
#创建以下目录,以备后用
[root@master hadoop-2.7.5]# mkdir tmp
[root@master hadoop-2.7.5]# mkdir logs
[root@master hadoop-2.7.5]# mkdir -p hdfs/name
[root@master hadoop-2.7.5]# mkdir -p hdfs/data</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322957_2019"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 155px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>7</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>7</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#进入hadoop-2.7.5主目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hadoop]<span class="cm-comment"># cd hadoop-2.7.5</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#创建以下目录,以备后用</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># mkdir tmp</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># mkdir logs</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># mkdir -p hdfs/name</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># mkdir -p hdfs/data</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 155px;"></div><div class="CodeMirror-gutters" style="height: 185px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-size: 1.5rem; line-height: 38.4px; font-family: 楷体; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.4 修改配置</span></b></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="line-height: 38.4px;"><span data-wiz-span="data-wiz-span" style="color: inherit; font-size: 1.167rem;">5.4.1 修改</span></span></font><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="font-size: 1.5rem; line-height: 38.4px;"><span style="font-size: 1rem;"></span></span></font><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="line-height: 38.4px;"><span data-wiz-span="data-wiz-span" style="color: inherit; font-size: 1.167rem;">hadoop-env.sh文件</span></span></font></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355103_1982" class="wiz-code-container"><textarea style="display: none;">[root@master hadoop-2.7.5]# vi etc/hadoop/hadoop-env.sh
#修改JAVA_HOME为以下内容,否则容易出现Hadoop无法启动问题
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322919_7654"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 71px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi etc/hadoop/hadoop-env.sh</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#修改JAVA_HOME为以下内容,否则容易出现Hadoop无法启动问题</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">JAVA_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Java/jdk1.8.0_152</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 71px;"></div><div class="CodeMirror-gutters" style="height: 101px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="line-height: 38.4px;"><span data-wiz-span="data-wiz-span" style="color: inherit; font-size: 1.167rem;">5.4.2 修改</span></span></font><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="font-size: 1.5rem; line-height: 38.4px;"><span style="font-size: 1rem;"></span></span></font><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="line-height: 38.4px;"><span data-wiz-span="data-wiz-span" style="color: inherit; font-size: 1.167rem;">yarn-env.sh文件</span></span></font></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355100_4980" class="wiz-code-container"><textarea style="display: none;">[root@master hadoop-2.7.5]# vi etc/hadoop/yarn-env.sh 
#修改JAVA_HOME为以下内容
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322873_5133"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 71px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi etc/hadoop/yarn-env.sh </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#修改JAVA_HOME为以下内容</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">JAVA_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Java/jdk1.8.0_152</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 71px;"></div><div class="CodeMirror-gutters" style="height: 101px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="font-family: 楷体; font-size: 1.167rem; line-height: 38.4px; color: inherit;">5.4.3 编辑slaves文件</span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355096_2543" class="wiz-code-container"><textarea style="display: none;">#该文件用于记录本集群有哪些数据节点
[root@master hadoop-2.7.5]# vi etc/hadoop/slaves 
#删除该文件中原来的内容,添加以下内容
slave1
slave2
slave3</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322833_8603"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 134px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>6</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>6</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#该文件用于记录本集群有哪些数据节点</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi etc/hadoop/slaves </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#删除该文件中原来的内容,添加以下内容</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave1</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave2</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave3</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 134px;"></div><div class="CodeMirror-gutters" style="height: 164px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="font-family: 楷体; font-size: 1.167rem; line-height: 38.4px; color: inherit;">5.4.4 修改core-site.xml文件</span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355092_2964" class="wiz-code-container"><textarea style="display: none;">[root@master hadoop-2.7.5]# vi etc/hadoop/core-site.xml</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322804_2235"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi etc/hadoop/core-site.xml</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 59px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    该文件为Hadoop的核心配置文件,非常重要</span><br></div><div data-mode="XML" data-theme="base16-light"  id="wiz_cm_1520177355086_6718" class="wiz-code-container"><textarea style="display: none;"><!--在<configuration></configuration>中间添加一下内容-->
<property>
    <name>fs.defaultFS</name><!--定义Hadoop Master的URI和端口-->
    <value>hdfs://master:9000</value>
</property>
<property>
    <name>hadoop.tmp.dir</name><!--hadoop的临时存储目录-->
    <value>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/tmp</value>
</property>
<property>
    <name>io.file.buffer.size</name><!--用作序列化文件处理时读写buffer的大小-->
    <value>131702</value>
</property></textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322752_1914"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 281px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>13</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>13</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment"><!--在<configuration></configuration>中间添加一下内容--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>fs.defaultFS<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--定义Hadoop Master的URI和端口--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>hdfs://master:9000<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hadoop.tmp.dir<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--hadoop的临时存储目录--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/tmp<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>io.file.buffer.size<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--用作序列化文件处理时读写buffer的大小--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>131702<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 281px;"></div><div class="CodeMirror-gutters" style="height: 311px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span data-wiz-span="data-wiz-span" style="line-height: 38.4px; font-family: 楷体; color: inherit; font-size: 1.167rem;">5.4.5 修改</span><span style="line-height: 38.4px; font-family: 楷体; font-size: 1rem; list-style-type: decimal;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">hdfs-site.xml文件</span></span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355082_5816" class="wiz-code-container"><textarea style="display: none;">[root@master hadoop-2.7.5]# vi etc/hadoop/hdfs-site.xml </textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322714_1577"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi etc/hadoop/hdfs-site.xml </span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 59px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    该文件为Hadoop的HDFS的配置文件</span></div><div data-mode="XML" data-theme="base16-light"  id="wiz_cm_1520177355077_2845" class="wiz-code-container"><textarea style="display: none;"><!--在<configuration></configuration>中间添加一下内容-->
<property><!--namenode节点数据存储目录-->
    <name>dfs.namenode.name.dir</name>
    <value>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name</value>
</property>
<property><!--datanode数据存储目录-->
    <name>dfs.datanode.data.dir</name>
    <value>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/data</value>
</property>
<property><!--指定DataNode存储block的副本数量,不大于DataNode的个数就行,默认为3-->
    <name>dfs.replication</name>
    <value>2</value>
</property>
<property><!--指定master的http协议访问地址-->
    <name>dfs.namenode.secondary.http-address</name>
    <value>master:50090</value>
</property>
<property><!--指定master的https协议访问地址-->
    <name>dfs.namenode.secondary.https-address</name>
    <value>192.168.10.250:50091</value>
</property>
<property><!--必须设置为true,否则就不能通过web访问hdfs上的文件信息-->
    <name>dfs.webhdfs.enabled</name>
    <value>true</value>
</property></textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322631_7470"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 533px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>25</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>25</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment"><!--在<configuration></configuration>中间添加一下内容--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--namenode节点数据存储目录--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>dfs.namenode.name.dir<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--datanode数据存储目录--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>dfs.datanode.data.dir<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/data<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--指定DataNode存储block的副本数量,不大于DataNode的个数就行,默认为3--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>dfs.replication<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>2<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--指定master的http协议访问地址--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>dfs.namenode.secondary.http-address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:50090<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--指定master的https协议访问地址--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>dfs.namenode.secondary.https-address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>192.168.10.250:50091<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">22</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--必须设置为true,否则就不能通过web访问hdfs上的文件信息--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">23</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>dfs.webhdfs.enabled<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">24</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>true<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">25</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 533px;"></div><div class="CodeMirror-gutters" style="height: 563px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="font-size: 1.167rem; line-height: 38.4px; font-family: 楷体; color: inherit;">5.4.6 修改yarn-site.xml文件</span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355074_11" class="wiz-code-container"><textarea style="display: none;">[root@master hadoop-2.7.5]# vi etc/hadoop/yarn-site.xml</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322603_6763"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi etc/hadoop/yarn-site.xml</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 59px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div data-mode="XML" data-theme="base16-light"  id="wiz_cm_1520177355071_9864" class="wiz-code-container"><textarea style="display: none;"><property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
</property>
<property>
    <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
    <name>yarn.resourcemanager.address</name>
    <value>master:8032</value>
</property>
<property>
    <name>yarn.resourcemanager.scheduler.address</name>
    <value>master:8030</value>
</property>
<property>
    <name>yarn.resourcemanager.resource-tracker.address</name>
    <value>master:8031</value>
</property>
<property>
    <name>yarn.resourcemanager.admin.address</name>
    <value>master:8033</value>
</property>
<property>
    <name>yarn.resourcemanager.webapp.address</name>
    <value>master:8088</value>
</property>
<property>
    <name>yarn.nodemanager.resource.memory-mb</name>
    <value>2048</value>
</property>
</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322522_4985"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 701px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>33</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>33</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.nodemanager.aux-services<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>mapreduce_shuffle<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.nodemanager.aux-services.mapreduce.shuffle.class<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>org.apache.hadoop.mapred.ShuffleHandler<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.resourcemanager.address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:8032<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.resourcemanager.scheduler.address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:8030<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.resourcemanager.resource-tracker.address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:8031<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">22</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.resourcemanager.admin.address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">23</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:8033<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">24</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">25</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">26</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.resourcemanager.webapp.address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">27</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:8088<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">28</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">29</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">30</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>yarn.nodemanager.resource.memory-mb<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">31</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>2048<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">32</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">33</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text=""></span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 701px;"></div><div class="CodeMirror-gutters" style="height: 731px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="font-size: 1.167rem; line-height: 38.4px; font-family: 楷体; color: inherit;">5.4.7 修改mapred-site.xml文件</span></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="font-size: 1.167rem; font-family: 楷体; line-height: 38.4px;">但是这个文件并不存在,先复制再打开</span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355068_1806" class="wiz-code-container"><textarea style="display: none;">#使用cp命令复制一份出来,不要自己创建
[root@master hadoop-2.7.5]# cp etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml
[root@master hadoop-2.7.5]# vi etc/hadoop/mapred-site.xml</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322486_1946"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 71px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#使用cp命令复制一份出来,不要自己创建</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># cp etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi etc/hadoop/mapred-site.xml</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 71px;"></div><div class="CodeMirror-gutters" style="height: 101px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div data-mode="XML" data-theme="base16-light"  id="wiz_cm_1520177355064_4914" class="wiz-code-container"><textarea style="display: none;"><property><!--使用yarn运行mapreduce程序-->
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
</property>
<property><!--MapReduce JobHistory Server地址-->
    <name>mapreduce.jobhistory.address</name>
    <value>master:10020</value>
</property>
<property><!--MapReduce JobHistory Server Web界面地址-->
    <name>mapreduce.jobhistory.webapp.address</name>
    <value>master:19888</value>
</property></textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322431_7952"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 260px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>12</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>12</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--使用yarn运行mapreduce程序--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>mapreduce.framework.name<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>yarn<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--MapReduce JobHistory Server地址--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>mapreduce.jobhistory.address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:10020<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--MapReduce JobHistory Server Web界面地址--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>mapreduce.jobhistory.webapp.address<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>master:19888<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 260px;"></div><div class="CodeMirror-gutters" style="height: 290px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="font-size: 1.5rem; line-height: 38.4px;"><span data-wiz-span="data-wiz-span" style="font-size: 1.5rem;"><b><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.5 文件分发</span></b></span></span></font><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="font-size: 1.5rem; line-height: 38.4px;"><span data-wiz-span="data-wiz-span" style="font-size: 1.5rem;"><b> </b></span></span></font></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="font-size: 1.167rem; line-height: 38.4px; font-family: 楷体; color: inherit;">将master节点上的Hadoop目录远程拷贝到其他slave节点</span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355062_8049" class="wiz-code-container"><textarea style="display: none;">[root@master hadoop-2.7.5]# scp -r /opt/SoftWare/Hadoop root@slave1:/opt/SoftWare/
[root@master hadoop-2.7.5]# scp -r /opt/SoftWare/Hadoop root@slave2:/opt/SoftWare/
[root@master hadoop-2.7.5]# scp -r /opt/SoftWare/Hadoop root@slave3:/opt/SoftWare/</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322393_3531"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 71px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>3</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># scp -r /opt/SoftWare/Hadoop root@slave1:/opt/SoftWare/</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># scp -r /opt/SoftWare/Hadoop root@slave2:/opt/SoftWare/</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># scp -r /opt/SoftWare/Hadoop root@slave3:/opt/SoftWare/</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 71px;"></div><div class="CodeMirror-gutters" style="height: 101px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; font-size: 1.5rem; line-height: 38.4px; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.6 修改环境变量</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355059_2214" class="wiz-code-container"><textarea style="display: none;">#各节点均编辑/etc/profile文件
[root@master hadoop-2.7.5]# vi /etc/profile
#添加以下内容
export HADOOP_HOME=/opt/SoftWare/Hadoop/hadoop-2.7.5
export HADOOP_LOG_DIR=$HADOOP_HOME/logs
export YARN_LOG_DIR=$HADOOP_LOG_DIR
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
#使设置立即生效
[root@master hadoop-2.7.5]# source /etc/profile</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322352_8438"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 197px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#各节点均编辑/etc/profile文件</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># vi /etc/profile</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#添加以下内容</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">HADOOP_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Hadoop/hadoop-2.7.5</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">HADOOP_LOG_DIR</span><span class="cm-operator">=</span><span class="cm-def">$HADOOP_HOME</span>/logs</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">YARN_LOG_DIR</span><span class="cm-operator">=</span><span class="cm-def">$HADOOP_LOG_DIR</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">PATH</span><span class="cm-operator">=</span><span class="cm-def">$HADOOP_HOME</span>/bin:<span class="cm-def">$HADOOP_HOME</span>/sbin:<span class="cm-def">$PATH</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#使设置立即生效</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># source /etc/profile</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 197px;"></div><div class="CodeMirror-gutters" style="height: 227px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; font-size: 1.5rem; line-height: 38.4px; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.7 格式化Hadoop</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355055_5613" class="wiz-code-container"><textarea style="display: none;">#输入以下命令
[root@master hadoop-2.7.5]# bin/hdfs namenode -format
#在最后出现以下内容说明格式化成功
18/03/01 10:07:59 INFO namenode.FSImage: Allocated new BlockPoolId: BP-1057357071-192.168.100.100-1519870079201
18/03/01 10:07:59 INFO common.Storage: Storage directory /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name has been successfully formatted.
18/03/01 10:07:59 INFO namenode.FSImageFormatProtobuf: Saving image file /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name/current/fsimage.ckpt_0000000000000000000 using no compression
18/03/01 10:07:59 INFO namenode.FSImageFormatProtobuf: Image file /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name/current/fsimage.ckpt_0000000000000000000 of size 321 bytes saved in 0 seconds.
18/03/01 10:07:59 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
18/03/01 10:07:59 INFO util.ExitUtil: Exiting with status 0
18/03/01 10:07:59 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at master/192.168.100.100
************************************************************/
#注意上面的第二行最后的successfully formatted</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322303_2416"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 302px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>14</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>14</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#输入以下命令</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># bin/hdfs namenode -format</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#在最后出现以下内容说明格式化成功</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">18</span>/03/01 <span class="cm-number">10</span>:07:59 INFO namenode.FSImage: Allocated new BlockPoolId: BP-1057357071-192.168.100.100-1519870079201</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">18</span>/03/01 <span class="cm-number">10</span>:07:59 INFO common.Storage: Storage directory /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name has been successfully formatted.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">18</span>/03/01 <span class="cm-number">10</span>:07:59 INFO namenode.FSImageFormatProtobuf: Saving image file /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name/current/fsimage.ckpt_0000000000000000000 using no compression</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">18</span>/03/01 <span class="cm-number">10</span>:07:59 INFO namenode.FSImageFormatProtobuf: Image file /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name/current/fsimage.ckpt_0000000000000000000 of size <span class="cm-number">321</span> bytes saved <span class="cm-keyword">in</span> <span class="cm-number">0</span> seconds.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">18</span>/03/01 <span class="cm-number">10</span>:07:59 INFO namenode.NNStorageRetentionManager: Going to retain <span class="cm-number">1</span> images with txid ><span class="cm-operator">=</span> <span class="cm-number">0</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">18</span>/03/01 <span class="cm-number">10</span>:07:59 INFO util.ExitUtil: Exiting with status <span class="cm-number">0</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">18</span>/03/01 <span class="cm-number">10</span>:07:59 INFO namenode.NameNode: SHUTDOWN_MSG: </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">/************************************************************</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">SHUTDOWN_MSG: Shutting down NameNode at master/192.168.100.100</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">************************************************************/</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#注意上面的第二行最后的successfully formatted</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 302px;"></div><div class="CodeMirror-gutters" style="height: 332px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; font-size: 1.5rem; line-height: 38.4px; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.8 启动Hadoop集群</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355052_2517" class="wiz-code-container"><textarea style="display: none;">#先启动HDFS,按照新版要求,不建议直接使用start-all.sh命令
[root@master hadoop-2.7.5]# sbin/start-dfs.sh
#然后会在控制台打印以下信息
Starting namenodes on [master]
master: starting namenode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-namenode-master.out
slave1: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave1.out
slave2: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave2.out
slave3: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave3.out
Starting secondary namenodes [master]
master: starting secondarynamenode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-secondarynamenode-master.out
#然后启动YARN
[root@master hadoop-2.7.5]# sbin/start-yarn.sh
#然后会在控制台打印以下信息
starting yarn daemons
starting resourcemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-resourcemanager-master.out
slave2: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave2.out
slave3: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave3.out
slave1: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave1.out</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322248_4495"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 386px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>18</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>18</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#先启动HDFS,按照新版要求,不建议直接使用start-all.sh命令</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># sbin/start-dfs.sh</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#然后会在控制台打印以下信息</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Starting namenodes on [master]</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">master: starting namenode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-namenode-master.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave1: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave1.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave2: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave2.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave3: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave3.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Starting secondary namenodes [master]</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">master: starting secondarynamenode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-secondarynamenode-master.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#然后启动YARN</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># sbin/start-yarn.sh</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#然后会在控制台打印以下信息</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">starting yarn daemons</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">starting resourcemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-resourcemanager-master.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave2: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave2.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave3: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave3.out</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">slave1: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave1.out</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 386px;"></div><div class="CodeMirror-gutters" style="height: 416px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family:楷体;font-size:1.5rem"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; font-size: 1rem; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; font-size: 1.5rem; color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; color: inherit;">5.9 检测集群是否搭建成功</span></b></div><div><span data-wiz-span="data-wiz-span" style="font-family:楷体;font-size:1.167rem">    5.9.1 使用jps命令查看</span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355047_4932" class="wiz-code-container"><textarea style="display: none;">#master检测
[root@master hadoop-2.7.5]# jps
44658 ResourceManager
44509 SecondaryNameNode
44318 NameNode
44958 Jps
#slave节点检测
[root@slave1 ~]# jps
2262 DataNode
2360 NodeManager
2461 Jps</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322213_9820"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 239px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>11</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>11</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#master检测</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hadoop-2.7.5]<span class="cm-comment"># jps</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">44658</span> ResourceManager</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">44509</span> SecondaryNameNode</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">44318</span> NameNode</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">44958</span> Jps</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#slave节点检测</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@slave1 ~]<span class="cm-comment"># jps</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">2262</span> DataNode</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">2360</span> NodeManager</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">2461</span> Jps</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 239px;"></div><div class="CodeMirror-gutters" style="height: 269px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family:楷体;font-size:1.167rem">    5.9.2 使用WEB界面访问</span></div><div><span data-wiz-span="data-wiz-span" style="font-family:楷体;font-size:1.167rem">    在浏览器地址栏中输入</span><font face="楷体"><span style="font-size: 1.5rem; line-height: 38.4px;"><a href="http://192.168.100.100:50070"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">http://192.168.100.100:50070</span></a><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">  即可</span></span></font></div><div><span data-wiz-span="data-wiz-span"><div style="font-weight: bold; font-family: 楷体;"><b style="color: inherit; line-height: 1.6;"><div style="display: inline !important;"><img src="05-Hadoop集群+Hive+MySQL搭建_files/9a07905c-e71a-4bbc-905e-33dba600c4d1.png" class="" style="vertical-align: bottom;"></div></b></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    在浏览器地址栏中输入 </span><a href="http://192.168.100.100:8088"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">http://192.168.100.100:8088</span></a><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">   即可</span></div><div style="font-weight: bold;"><b style="line-height: 1.6; font-family: 楷体;"><div style="display: inline !important;"><img src="05-Hadoop集群+Hive+MySQL搭建_files/789cfce5-37d6-4262-b88e-be91777145f2.png" style="vertical-align: bottom;" class=""></div></b><br></div><b style="font-family: 楷体;"><div><br></div></b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><b><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.5rem;">6. MySQL数据库的安装</span></b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family:楷体;font-size:1.167rem"><b>    6.1 下载<span style="color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.875rem; text-align: start; text-indent: 0px; display: inline !important; background-color: rgb(255, 255, 255);"></span></b><b><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.875rem; text-align: start; text-indent: 0px; display: inline !important;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;">YUM源rpm安装包</span></span></b></span></div><div><span data-wiz-span="data-wiz-span"><font face="楷体"><span style="font-size: 1.167rem;">    下载地址:</span></font></span><font face="楷体"><span style="font-size: 1.167rem; line-height: 29.8752px;"><a href="https://dev.mysql.com/downloads/repo/yum/">https://dev.mysql.com/downloads/repo/yum/</a>  </span></font><font face="楷体" style="line-height: 1.6;"><span style="font-size: 1.167rem;"> 选择 <span style="color:rgb(102, 102, 102);font-family:'Open Sans', Arial, Helvetica, sans-serif;font-size:0.75rem;font-style:normal;font-weight:normal;text-align:start;text-indent:0px;display:inline !important;background-color:rgb(243, 243, 243);"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">mysql57-community-release-el7-11.noarch.rpm</span></span></span></font><span style="font-family: 楷体; font-size: 1.167rem; line-height: 1.6;">下载</span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355043_9305" class="wiz-code-container"><textarea style="display: none;">#下载mysql源
[root@master ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
#安装mysql源
[root@master ~]# yum localinstall mysql57-community-release-el7-11.noarch.rpm 
#检测源是否安装成功,显示以下信息表示源安装成功
[root@master ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64        MySQL Connectors Community           45
mysql-tools-community/x86_64             MySQL Tools Community                57
mysql57-community/x86_64                 MySQL 5.7 Community Server          247</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322181_491"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 197px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#下载mysql源</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#安装mysql源</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># yum localinstall mysql57-community-release-el7-11.noarch.rpm </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#检测源是否安装成功,显示以下信息表示源安装成功</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># yum repolist enabled | grep "mysql.*-community.*"</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql-connectors-community/x86_64        MySQL Connectors Community           <span class="cm-number">45</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql-tools-community/x86_64             MySQL Tools Community                <span class="cm-number">57</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql57-community/x86_64                 MySQL <span class="cm-number">5</span>.7 Community Server          <span class="cm-number">247</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 197px;"></div><div class="CodeMirror-gutters" style="height: 227px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><b><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">   <span data-wiz-span="data-wiz-span" style="font-family: 楷体;"> </span><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;">6</span></span><span style="color: inherit; font-family: 楷体; font-size: 1.167rem; line-height: 1.6;">.2 安装MySQL</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355040_8879" class="wiz-code-container"><textarea style="display: none;">[root@master ~]# yum install mysql-community-server</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322162_6980"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 29px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>1</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># yum install mysql-community-server</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 29px;"></div><div class="CodeMirror-gutters" style="height: 59px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family:楷体;font-size:1.167rem"><b>    6.3 启动MySQL服务</b></span></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355035_5764" class="wiz-code-container"><textarea style="display: none;">#启动MySQL服务
[root@master ~]# systemctl start mysqld
#查看MySQL服务启动状态
[root@master ~]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 三 2018-02-28 11:15:52 CST; 14s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 11568 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 11495 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 11572 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─11572 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pi...

2月 28 11:15:49 test systemd[1]: Starting MySQL Server...
2月 28 11:15:52 test systemd[1]: Started MySQL Server.
#设置开机自动启动
[root@master ~]# systemctl enable mysqld
#设置后台自动运行
[root@master ~]# systemctl daemon-reload</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177322096_90"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 449px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><span><span></span>x</span><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>21</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#启动MySQL服务</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># systemctl start mysqld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#查看MySQL服务启动状态</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># systemctl status mysqld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">● mysqld.service <span class="cm-attribute">-</span> MySQL Server</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">   Active: active (running) since 三 <span class="cm-number">2018</span><span class="cm-attribute">-02-28</span> <span class="cm-number">11</span>:15:52 CST; 14s ago</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">     Docs: man:mysqld(8)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">           http://dev.mysql.com/doc/refman/en/using-systemd.html</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  Process: <span class="cm-number">11568</span> <span class="cm-def">ExecStart</span><span class="cm-operator">=</span>/usr/sbin/mysqld <span class="cm-attribute">--daemonize</span> <span class="cm-attribute">--pid-file</span><span class="cm-operator">=</span>/var/run/mysqld/mysqld.pid <span class="cm-def">$MYSQLD_OPTS</span> <span class="cm-def">(code</span><span class="cm-operator">=</span>exited, <span class="cm-def">status</span><span class="cm-operator">=</span><span class="cm-number">0</span>/SUCCESS)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  Process: <span class="cm-number">11495</span> <span class="cm-def">ExecStartPre</span><span class="cm-operator">=</span>/usr/bin/mysqld_pre_systemd <span class="cm-def">(code</span><span class="cm-operator">=</span>exited, <span class="cm-def">status</span><span class="cm-operator">=</span><span class="cm-number">0</span>/SUCCESS)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> Main PID: <span class="cm-number">11572</span> (mysqld)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">   CGroup: /system.slice/mysqld.service</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">           └─11572 /usr/sbin/mysqld <span class="cm-attribute">--daemonize</span> <span class="cm-attribute">--pid-file</span><span class="cm-operator">=</span>/var/run/mysqld/mysqld.pi...</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text=""></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">2</span>月 <span class="cm-number">28</span> <span class="cm-number">11</span>:15:49 test systemd[1]: Starting MySQL Server...</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">2</span>月 <span class="cm-number">28</span> <span class="cm-number">11</span>:15:52 test systemd[1]: Started MySQL Server.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#设置开机自动启动</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># systemctl enable mysqld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#设置后台自动运行</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># systemctl daemon-reload</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 449px;"></div><div class="CodeMirror-gutters" style="height: 479px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;"><span style="font-family: Helvetica, 'Hiragino Sans GB', 寰蒋闆呴粦, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; line-height: 1.6;">    </span></span><span style="line-height: 1.6;">    </span><b style="font-family: 楷体; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">6.4 修改root默认密码</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355031_5896" class="wiz-code-container"><textarea style="display: none;">#在日志文件中查看mysql的root用户默认密码
#如下,默认密码为root@localhost:后面的内容,即:itso(d#N>0rK
[root@master ~]# grep 'temporary password' /var/log/mysqld.log 
2018-02-28T03:15:49.608817Z 1 [Note] A temporary password is generated for root@localhost: itso(d#N>0rK
#进入mysql
[root@master ~]# mysql -uroot -p
#输入密码itso(d#N>0rK
#修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
#在mysql5.7中必然会出现下面的额错误,原因是因为密码策略问题,密码不能太过简单
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
#然后可以查看一下密码策略,在此之前先更改一下密码,否则无论你操作什么都会提示你修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '12Zhang.';
Query OK, 0 rows affected (0.00 sec)
#查看密码策略
mysql> show variables like '%password%';
+---------------------------------------+--------+
| Variable_name                         | Value  |
+---------------------------------------+--------+
| default_password_lifetime             | 0      |        
| disconnect_on_expired_password        | ON     |
| log_builtin_as_identified_by_password | OFF    |
| mysql_native_password_proxy_users     | OFF    |
| old_passwords                         | 0      |
| report_password                       |        |
| sha256_password_proxy_users           | OFF    |
| validate_password_check_user_name     | OFF    | 设为 ON 时密码中不允许包含用户名
| validate_password_dictionary_file     |        | 用于验证密码强度的字典文件路径,策略为STRONG才需要
| validate_password_length              | 8      | 最小长度为8个字符
| validate_password_mixed_case_count    | 1      | 至少1个大小写字母(各一个)
| validate_password_number_count        | 1      | 至少1个数字 
| validate_password_policy              | MEDIUM | 密码策略,默认为MEDIUM策略
| validate_password_special_char_count  | 1      | 至少1个特殊字符
+---------------------------------------+--------+
#取消密码策略检查
#修改/etc/my.cnf文件,在文件中添加以下内容以禁用密码策略
validate_password=off
[root@master ~]# vi /etc/my.cnf
#重新启动mysql服务
[root@master opt]# systemctl restart mysqld
#再次进入mysql,修改密码
[root@master ~]# mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321995_3213"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 911px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>43</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>43</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#在日志文件中查看mysql的root用户默认密码</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#如下,默认密码为root@localhost:后面的内容,即:itso(d#N>0rK</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># grep 'temporary password' /var/log/mysqld.log </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">2018</span><span class="cm-attribute">-02-28T03</span>:15:49.608817Z <span class="cm-number">1</span> [Note] A temporary password is generated <span class="cm-keyword">for</span> root@localhost: itso(d<span class="cm-comment">#N>0rK</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#进入mysql</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># mysql -uroot -p</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#输入密码itso(d#N>0rK</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#修改密码</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql> ALTER USER <span class="cm-string">'root'</span>@<span class="cm-string">'localhost'</span> IDENTIFIED BY <span class="cm-string">'123456'</span>;</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#在mysql5.7中必然会出现下面的额错误,原因是因为密码策略问题,密码不能太过简单</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ERROR <span class="cm-number">1819</span> (HY000): Your password does not satisfy the current policy requirements</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#然后可以查看一下密码策略,在此之前先更改一下密码,否则无论你操作什么都会提示你修改密码</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql> ALTER USER <span class="cm-string">'root'</span>@<span class="cm-string">'localhost'</span> IDENTIFIED BY <span class="cm-string">'12Zhang.'</span>;</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Query OK, <span class="cm-number">0</span> rows affected (0.00 sec)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#查看密码策略</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql> show variables like <span class="cm-string">'%password%'</span>;</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">+</span><span class="cm-attribute">---------------------------------------</span><span class="cm-operator">+</span><span class="cm-attribute">--------</span><span class="cm-operator">+</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| Variable_name                         | Value  |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">+</span><span class="cm-attribute">---------------------------------------</span><span class="cm-operator">+</span><span class="cm-attribute">--------</span><span class="cm-operator">+</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| default_password_lifetime             | <span class="cm-number">0</span>      |        </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| disconnect_on_expired_password        | ON     |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">22</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| log_builtin_as_identified_by_password | OFF    |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">23</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| mysql_native_password_proxy_users     | OFF    |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">24</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| old_passwords                         | <span class="cm-number">0</span>      |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">25</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| report_password                       |        |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">26</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| sha256_password_proxy_users           | OFF    |</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">27</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| validate_password_check_user_name     | OFF    | 设为 ON 时密码中不允许包含用户名</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">28</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| validate_password_dictionary_file     |        | 用于验证密码强度的字典文件路径,策略为STRONG才需要</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">29</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| validate_password_length              | <span class="cm-number">8</span>      | 最小长度为8个字符</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">30</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| validate_password_mixed_case_count    | <span class="cm-number">1</span>      | 至少1个大小写字母(各一个)</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">31</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| validate_password_number_count        | <span class="cm-number">1</span>      | 至少1个数字 </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">32</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| validate_password_policy              | MEDIUM | 密码策略,默认为MEDIUM策略</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">33</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">| validate_password_special_char_count  | <span class="cm-number">1</span>      | 至少1个特殊字符</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">34</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">+</span><span class="cm-attribute">---------------------------------------</span><span class="cm-operator">+</span><span class="cm-attribute">--------</span><span class="cm-operator">+</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">35</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#取消密码策略检查</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">36</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#修改/etc/my.cnf文件,在文件中添加以下内容以禁用密码策略</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">37</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">validate_password</span><span class="cm-operator">=</span>off</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">38</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># vi /etc/my.cnf</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">39</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#重新启动mysql服务</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">40</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master opt]<span class="cm-comment"># systemctl restart mysqld</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">41</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#再次进入mysql,修改密码</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">42</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># mysql -uroot -p</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">43</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql> ALTER USER <span class="cm-string">'root'</span>@<span class="cm-string">'localhost'</span> IDENTIFIED BY <span class="cm-string">'123456'</span>;</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 911px;"></div><div class="CodeMirror-gutters" style="height: 941px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体;">  <b></b><b><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;"> </span></b></span><span style="line-height: 1.6;">  </span><b style="font-family: 楷体; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem;">6.5 修改数据库编码为utf-8</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355028_6842" class="wiz-code-container"><textarea style="display: none;">#在/etc/my.cnf文件中的[mysqld]内添加以下内容
character_set_server=utf8
init_connect='SET NAMES utf8'
[root@master ~]# vi /etc/my.cnf</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321967_8981"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 92px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>4</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>4</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#在/etc/my.cnf文件中的[mysqld]内添加以下内容</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">character_set_server</span><span class="cm-operator">=</span>utf8</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-def">init_connect</span><span class="cm-operator">=</span><span class="cm-string">'SET NAMES utf8'</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># vi /etc/my.cnf</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 92px;"></div><div class="CodeMirror-gutters" style="height: 122px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="line-height: 1.6;">    </span><span style="line-height: 1.6;">    </span><b style="line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;">6.6 添加root用户的远程登录权限</span></b></div><div>       <span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;"> 默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户</span><br></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355025_7171" class="wiz-code-container"><textarea style="display: none;">#进入mysql
[root@master ~]# mysql -uroot -p123456
#修改root的远程访问权限
#root代表用户名 , %代表任何主机都可以访问 , 123456为root访问的密码
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 
#flush privileges刷新MySQL的系统权限,使其即时生效,否则就重启服务器
mysql> FLUSH PRIVILEGES;
#退出
mysql> exit;</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321934_6433"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 197px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#进入mysql</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># mysql -uroot -p123456</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#修改root的远程访问权限</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#root代表用户名 , %代表任何主机都可以访问 , 123456为root访问的密码</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql> GRANT ALL PRIVILEGES ON *.* TO <span class="cm-string">'root'</span>@<span class="cm-string">'%'</span> IDENTIFIED BY <span class="cm-string">'123456'</span> WITH GRANT OPTION; </span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#flush privileges刷新MySQL的系统权限,使其即时生效,否则就重启服务器</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql> FLUSH PRIVILEGES;</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#退出</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysql> <span class="cm-keyword">exit</span>;</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 197px;"></div><div class="CodeMirror-gutters" style="height: 227px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.5rem;"><b>7. Hive安装</b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    为了方便操作Hive的服务端和客户端均安装在master节点上</span></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    <b>7.1 下载</b></span></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    下载地址:<a href="http://mirrors.hust.edu.cn/apache/hive/">http://mirrors.hust.edu.cn/apache/hive/</a></span> </div><div>       <span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;"><b> 7.2 上传并解压</b></span><br></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355022_8244" class="wiz-code-container"><textarea style="display: none;">#创建Hive目录
[root@master ~]# mkdir /opt/SoftWare/Hive
#进入到Hive目录
[root@master ~]# cd /opt/SoftWare/Hive
#通过xshell工具上传至master主机
[root@master Hive]# rz
#解压
[root@master Hive]# tar -zxvf apache-hive-2.3.2-bin.tar.gz
#修改文件夹的名字
[root@master Hive]# mv apache-hive-2.3.2-bin hive-2.3.2</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321898_4193"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 218px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>10</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>10</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#创建Hive目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># mkdir /opt/SoftWare/Hive</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#进入到Hive目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># cd /opt/SoftWare/Hive</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#通过xshell工具上传至master主机</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hive]<span class="cm-comment"># rz</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#解压</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hive]<span class="cm-comment"># tar -zxvf apache-hive-2.3.2-bin.tar.gz</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#修改文件夹的名字</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hive]<span class="cm-comment"># mv apache-hive-2.3.2-bin hive-2.3.2</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 218px;"></div><div class="CodeMirror-gutters" style="height: 248px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;"><span style="color: inherit; font-family: Helvetica, 'Hiragino Sans GB', 微软雅黑, 'Microsoft YaHei UI', SimSun, SimHei, arial, sans-serif; font-size: 1rem; line-height: 1.6;">    </span></span><span style="color: inherit; line-height: 1.6;">    </span><b style="font-family: 楷体; font-size: 1.167rem; color: inherit; line-height: 1.6;">7.3 配置环境变量</b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355018_4354" class="wiz-code-container"><textarea style="display: none;">#打开配置文件
[root@master Hive]# vi /etc/profile
#在后面追加以下内容
export HIVE_HOME=/opt/SoftWare/Hive/hive-2.3.2
export PATH=$PATH:$HIVE_HOME/bin
#使设置生效
[root@master Hive]# source /etc/profile</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321863_2479"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 155px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>7</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>7</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#打开配置文件</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hive]<span class="cm-comment"># vi /etc/profile</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#在后面追加以下内容</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">HIVE_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Hive/hive-2.3.2</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">PATH</span><span class="cm-operator">=</span><span class="cm-def">$PATH</span>:<span class="cm-def">$HIVE_HOME</span>/bin</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#使设置生效</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hive]<span class="cm-comment"># source /etc/profile</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 155px;"></div><div class="CodeMirror-gutters" style="height: 185px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    <b>7.4 修改配置文件</b></span><span style="font-size:0.875rem;font-family:Consolas;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;"><b>hive-site.xml</b></span></span></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; font-size: 0.875rem; font-family: Consolas;"><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">该文件不存在,需要复制hive-default.xml</span></span><font face="楷体" style="color: inherit; line-height: 1.6;"><span style="font-size: 1.167rem; line-height: 29.8752px;">.template来创建</span></font></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355012_7722" class="wiz-code-container"><textarea style="display: none;">#进入到hive-2.3.2目录
[root@master Hive]# cd hive-2.3.2/
#创建hive-site.xml文件
[root@master hive-2.3.2]# cp conf/hive-default.xml.template conf/hive-site.xml
[root@master hive-2.3.2]# vi conf/hive-site.xml 
#创建指定目录
[root@master hive-2.3.2]# hadoop fs -mkdir -p /hive/tmp
[root@master hive-2.3.2]# hadoop fs -mkdir -p /hive/logs
[root@master hive-2.3.2]# hadoop fs -mkdir -p /hive/warehouse</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321829_423"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 197px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>9</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#进入到hive-2.3.2目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master Hive]<span class="cm-comment"># cd hive-2.3.2/</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#创建hive-site.xml文件</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hive-2.3.2]<span class="cm-comment"># cp conf/hive-default.xml.template conf/hive-site.xml</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hive-2.3.2]<span class="cm-comment"># vi conf/hive-site.xml </span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#创建指定目录</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hive-2.3.2]<span class="cm-comment"># hadoop fs -mkdir -p /hive/tmp</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hive-2.3.2]<span class="cm-comment"># hadoop fs -mkdir -p /hive/logs</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hive-2.3.2]<span class="cm-comment"># hadoop fs -mkdir -p /hive/warehouse</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 197px;"></div><div class="CodeMirror-gutters" style="height: 227px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span data-wiz-span="data-wiz-span" style="font-family: 楷体; font-size: 1.167rem;">    修改配置如下:</span></div><div data-mode="XML" data-theme="base16-light"  id="wiz_cm_1520177355006_3664" class="wiz-code-container"><textarea style="display: none;"><property><!--数据库连接地址,使用MySQL存储元数据信息-->
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://master:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false</value>
</property>
  <property><!--数据库驱动-->
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
  </property>
  <property><!--数据库用户名-->
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>root</value>
    <description>Username to use against metastore database</description>
  </property>
<property><!--密码-->
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>123456</value>
    <description>password to use against metastore database</description>
  </property>
  <property><!--HDFS路径,用于存储不同 map/reduce 阶段的执行计划和这些阶段的中间输出结果。-->
    <name>hive.exec.local.scratchdir</name>
    <value>/hive/tmp</value>
  </property>
  <property><!--Hive 查询日志所在的目录,如果该值为空,将不创建查询日志。-->
    <name>hive.querylog.location</name>
    <value>/hive/logs</value>
  </property>
  <property><!--本地表的默认位置-->
    <name>hive.metastore.warehouse.dir</name>
    <value>/hive/warehouse</value>
  </property>
  <property>
    <name>hive.metastore.uris</name><!--Hive连接到该URI请求远程元存储的元数据-->
    <value>thrift://master:9083</value>
  </property>
  <property><!--关闭本地模式,此项不存在,需要自己添加-->
	 <name>hive.metastore.local</name>
	 <value>false</value>
  </property>
  <property>
    <name>hive.server2.logging.operation.log.location</name>
    <value>/hive/logs</value>
  </property>
<property>
    <name>hive.downloaded.resources.dir</name>
    <value>/hive/tmp/${hive.session.id}_resources</value>
  </property></textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321721_3845"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 974px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>46</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>46</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--数据库连接地址,使用MySQL存储元数据信息--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>javax.jdo.option.ConnectionURL<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>jdbc:mysql://master:3306/metastore?createDatabaseIfNotExist=true<span class="cm-atom">&amp;</span>useSSL=false<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--数据库驱动--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>javax.jdo.option.ConnectionDriverName<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>com.mysql.jdbc.Driver<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--数据库用户名--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>javax.jdo.option.ConnectionUserName<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>root<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">description</span><span class="cm-tag cm-bracket">></span>Username to use against metastore database<span class="cm-tag cm-bracket"></</span><span class="cm-tag">description</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--密码--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>javax.jdo.option.ConnectionPassword<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>123456<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">description</span><span class="cm-tag cm-bracket">></span>password to use against metastore database<span class="cm-tag cm-bracket"></</span><span class="cm-tag">description</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--HDFS路径,用于存储不同 map/reduce 阶段的执行计划和这些阶段的中间输出结果。--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hive.exec.local.scratchdir<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>/hive/tmp<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">22</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">23</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--Hive 查询日志所在的目录,如果该值为空,将不创建查询日志。--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">24</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hive.querylog.location<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">25</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>/hive/logs<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">26</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">27</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--本地表的默认位置--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">28</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hive.metastore.warehouse.dir<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">29</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>/hive/warehouse<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">30</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">31</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">32</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hive.metastore.uris<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--Hive连接到该URI请求远程元存储的元数据--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">33</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>thrift://master:9083<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">34</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">35</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span><span class="cm-comment"><!--关闭本地模式,此项不存在,需要自己添加--></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">36</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hive.metastore.local<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">37</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation" cm-text="	">    </span> <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>false<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">38</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">39</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">40</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hive.server2.logging.operation.log.location<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">41</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>/hive/logs<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">42</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">43</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket"><</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">44</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span>hive.downloaded.resources.dir<span class="cm-tag cm-bracket"></</span><span class="cm-tag">name</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">45</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">    <span class="cm-tag cm-bracket"><</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span>/hive/tmp/${hive.session.id}_resources<span class="cm-tag cm-bracket"></</span><span class="cm-tag">value</span><span class="cm-tag cm-bracket">></span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">46</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  <span class="cm-tag cm-bracket"></</span><span class="cm-tag">property</span><span class="cm-tag cm-bracket">></span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 974px;"></div><div class="CodeMirror-gutters" style="height: 1004px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;">7.5 修改配置文件</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177355001_8338" class="wiz-code-container"><textarea style="display: none;">[root@master hive-2.3.2]# vi bin/hive-config.sh
#添加以下内容
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152
export HADOOP_HOME=/opt/SoftWare/Hadoop/hadoop-2.7.5
export HIVE_HOME=/opt/SoftWare/Hive/hive-2.3.2</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321690_7315"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 113px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>5</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>5</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hive-2.3.2]<span class="cm-comment"># vi bin/hive-config.sh</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#添加以下内容</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">JAVA_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Java/jdk1.8.0_152</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">HADOOP_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Hadoop/hadoop-2.7.5</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">export</span> <span class="cm-def">HIVE_HOME</span><span class="cm-operator">=</span>/opt/SoftWare/Hive/hive-2.3.2</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 113px;"></div><div class="CodeMirror-gutters" style="height: 143px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="line-height: 1.6; color: inherit;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;">7.6 复制MySQL的驱动jar到hive/lib目录</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177354998_781" class="wiz-code-container"><textarea style="display: none;">[root@master hive-2.3.2]# cd lib
[root@master lib]# rz</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321666_8869"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 50px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>2</div></div><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>2</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master hive-2.3.2]<span class="cm-comment"># cd lib</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master lib]<span class="cm-comment"># rz</span></span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 50px;"></div><div class="CodeMirror-gutters" style="height: 80px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><span style="color: inherit; line-height: 1.6;">    </span><span style="color: inherit; line-height: 1.6;">    </span><b style="color: inherit; line-height: 1.6;"><span data-wiz-span="data-wiz-span" style="font-size: 1.167rem; font-family: 楷体;">7.7 对Hive进行初始化并启动Hive</span></b></div><div data-mode="Shell" data-theme="base16-light"  id="wiz_cm_1520177354879_8066" class="wiz-code-container"><textarea style="display: none;">[root@master lib]# cd $HIVE_HOME/bin
[root@master bin]# schematool -initSchema -dbType mysql
#出现以下信息代表初始化成功
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/SoftWare/Hive/hive-2.3.2/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/SoftWare/Hadoop/hadoop-2.7.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL:	 jdbc:mysql://master:3306/metastore?createDatabaseIfNotExist=true
Metastore Connection Driver :	 com.mysql.jdbc.Driver
Metastore connection User:	 root
Sun Mar 04 15:30:33 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Starting metastore schema initialization to 2.3.0
Initialization script hive-schema-2.3.0.mysql.sql
Sun Mar 04 15:30:34 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Initialization script completed
Sun Mar 04 15:30:36 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
schemaTool completed
#启动hive服务端
[root@master bin]# hive --service metastore
#启动Hive客户端
[root@master bin]# hive
#输入show tables;显示以下信息,说明Hive已经启动
hive> show tables;
OK
Time taken: 1.594 seconds</textarea><wiz_code_mirror><div class="CodeMirror CodeMirror-wrap cm-s-base16-light" data-id="wiz_cm_1520177321487_9832"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 20px; left: 33px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;" tabindex="0"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 29px; margin-bottom: 0px; border-right-width: 30px; min-height: 680px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>26</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class=" wiz-hide wiz_CodeMirror-cursors"><div class="CodeMirror-cursor" style="left: 4px; top: 0px; height: 21px;"> </div></div><div class="CodeMirror-code" role="presentation"><div class="CodeMirror-activeline" style="position: relative;"><div class=" wiz-hide wiz_CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -29px; width: 29px;"></div><div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master lib]<span class="cm-comment"># cd $HIVE_HOME/bin</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master bin]<span class="cm-comment"># schematool -initSchema -dbType mysql</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#出现以下信息代表初始化成功</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">SLF4J: Class path contains multiple SLF4J bindings.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">SLF4J: Found binding <span class="cm-keyword">in</span> [jar:file:/opt/SoftWare/Hive/hive-2.3.2/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">SLF4J: Found binding <span class="cm-keyword">in</span> [jar:file:/opt/SoftWare/Hadoop/hadoop-2.7.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">SLF4J: See http://www.slf4j.org/codes.html<span class="cm-comment">#multiple_bindings for an explanation.</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Metastore connection URL:<span class="cm-tab" role="presentation" cm-text="	">   </span> jdbc:mysql://master:3306/metastore<span class="cm-def">?createDatabaseIfNotExist</span><span class="cm-operator">=</span><span class="cm-atom">true</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Metastore Connection Driver :<span class="cm-tab" role="presentation" cm-text="	">   </span> com.mysql.jdbc.Driver</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Metastore connection User:<span class="cm-tab" role="presentation" cm-text="	">  </span> root</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Sun Mar <span class="cm-number">04</span> <span class="cm-number">15</span>:30:33 CST <span class="cm-number">2018</span> WARN: Establishing SSL connection without server<span class="cm-string">'s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn'</span>t <span class="cm-keyword">set</span>. For compliance with existing applications not using SSL the verifyServerCertificate property is <span class="cm-keyword">set</span> to <span class="cm-string">'false'</span>. You need either to explicitly disable SSL by setting <span class="cm-def">useSSL</span><span class="cm-operator">=</span><span class="cm-atom">false</span>, or <span class="cm-keyword">set</span> <span class="cm-def">useSSL</span><span class="cm-operator">=</span><span class="cm-atom">true</span> and provide truststore <span class="cm-keyword">for</span> server certificate verification.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Starting metastore schema initialization to <span class="cm-number">2</span>.3.0</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Initialization script hive-schema-2.3.0.mysql.sql</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Sun Mar <span class="cm-number">04</span> <span class="cm-number">15</span>:30:34 CST <span class="cm-number">2018</span> WARN: Establishing SSL connection without server<span class="cm-string">'s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn'</span>t <span class="cm-keyword">set</span>. For compliance with existing applications not using SSL the verifyServerCertificate property is <span class="cm-keyword">set</span> to <span class="cm-string">'false'</span>. You need either to explicitly disable SSL by setting <span class="cm-def">useSSL</span><span class="cm-operator">=</span><span class="cm-atom">false</span>, or <span class="cm-keyword">set</span> <span class="cm-def">useSSL</span><span class="cm-operator">=</span><span class="cm-atom">true</span> and provide truststore <span class="cm-keyword">for</span> server certificate verification.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Initialization script completed</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Sun Mar <span class="cm-number">04</span> <span class="cm-number">15</span>:30:36 CST <span class="cm-number">2018</span> WARN: Establishing SSL connection without server<span class="cm-string">'s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn'</span>t <span class="cm-keyword">set</span>. For compliance with existing applications not using SSL the verifyServerCertificate property is <span class="cm-keyword">set</span> to <span class="cm-string">'false'</span>. You need either to explicitly disable SSL by setting <span class="cm-def">useSSL</span><span class="cm-operator">=</span><span class="cm-atom">false</span>, or <span class="cm-keyword">set</span> <span class="cm-def">useSSL</span><span class="cm-operator">=</span><span class="cm-atom">true</span> and provide truststore <span class="cm-keyword">for</span> server certificate verification.</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">schemaTool completed</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#启动hive服务端</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master bin]<span class="cm-comment"># hive --service metastore</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#启动Hive客户端</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">22</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master bin]<span class="cm-comment"># hive</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">23</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#输入show tables;显示以下信息,说明Hive已经启动</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">24</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">hive> show tables;</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">25</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">OK</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -29px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">26</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Time taken: <span class="cm-number">1</span>.594 seconds</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 680px;"></div><div class="CodeMirror-gutters" style="height: 710px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div></div></div></div></wiz_code_mirror></div><div><br></div></body></html>

          2.2 同步时间工具
1
#安装ntpdate工具
2
[root@master ~]# yum -y install ntp ntpdate
3
#设置与网络时间同步
4
[root@master ~]# ntpdate cn.pool.ntp.org
5
#系统时间写入硬件时间
6
[root@master ~]# hwclock --systohc
          2.3 文件上传(rz)下载(sz)工具
          可以在Xshell工具中通过rz调出上传文件的窗口进行文件上传,也可以通过sz 文件名下载某一个文件
1
[root@master ~]# yum -y install lrzsz
          2.4 安装网络下载工具 wget
1
[root@test ~]# yum -y install wget
          2.4 关闭防火墙
1
#查看防火墙开启状态
2
[root@test ~]# systemctl status firewalld
3
#关闭防火墙
4
[root@test ~]# systemctl stop firewalld
5
#禁止开机启动防火墙
6
[root@test ~]# systemctl disable firewalld
7
#开启防火墙
8
[root@test ~]# systemctl start firewalld
9
#设置开机启动防火墙
10
[root@test ~]# systemctl enable firewalld
11
#重启防火墙
12
[root@test ~]# systemctl restart firewalld
3. 配置SSH免密码登录
          3.1 四台主机均按照步骤2安装基础软件工具(这里不再过多叙述)
          3.2 修改hosts文件,添加以下内容,四台主机均进行操作
1
[root@master ~]# vi /etc/hosts
2
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
3
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
4
192.168.100.100 master
5
192.168.100.101 slave1
6
192.168.100.102 slave2
7
192.168.100.103 slave3
          3.3 配置SSH免密码登录
1
#每台机器先使用ssh执行以下,以在主目录产生一个.ssh 文件夹
2
[root@master ~]# ssh master
3
#然后输入no即可
4
#每台机器均进入~/.ssh 目录进行操作
5
[root@master ~]# cd ~/.ssh
6
#输入以下命令,一路回车,用以产生公钥和秘钥
7
[root@master .ssh]# ssh-keygen -t rsa -P ''
8
#出现以下信息说明生成成功
9
Generating public/private rsa key pair.
10
Enter file in which to save the key (/root/.ssh/id_rsa): 
11
Your identification has been saved in /root/.ssh/id_rsa.
12
Your public key has been saved in /root/.ssh/id_rsa.pub.
13
The key fingerprint is:
14
SHA256:6YO1h1emM9gcWvv9OT6ftHxLnjP9u8p25x1o30oq3No root@master
15
The key's randomart image is:
16
+---[RSA 2048]----+
17
|                 |
18
|                 |
19
|                 |
20
|         .       |
21
|        S o o    |
22
|       + O *  .  |
23
|      . B.X. o.+.|
24
|         +o=+=**%|
25
|          .oEo*^^|
26
+----[SHA256]-----+
27
#将每台机器上的id_rsa.pub公钥内容复制到authorized_keys文件中
28
[root@master .ssh]# cp id_rsa.pub authorized_keys
29
#将所有的authorized_keys文件进行合并(最简单的方法是将其余三台slave主机的文件内容追加到master主机上)
30
[root@slave1 .ssh]# cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'
31
[root@slave2 .ssh]# cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'
32
[root@slave3 .ssh]# cat ~/.ssh/authorized_keys | ssh root@master 'cat >> ~/.ssh/authorized_keys'
33
#查看master上的authorized_keys文件内容,类似如下即可
34
[root@master .ssh]# more authorized_keys 
35
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5iw8+LlLxo0d77uaTChOKKJqfMHzp2jgzqV2hFAneFXqqWmr
36
Z4/FrMUPenmdss19bP4Up9G7PGbJu29yZDvkDwlmuqnVajYyDOsCl7PPXPWXMIlxMGUHgSXLnQQi6QnWp04vJKD
37
s0EbiRTd0ZYCSQefzJcZ8jbQ7bLYt6jtil7FfUupTdHTeexKKd8Mq3K7YFZHumKvhzs6wWiM+n41jANS083ss3O
38
YmAdO2cU0w1BhLVvJhdzd6fNG3RXVCXI2v0XxCUHiqI9Oewl2qPOfKzeyy09bJxo371Ezjmt8GMrkA/Ecepkvx1
39
2qwNzC9bSPLfbnPWVo2gIxe4mMaFqCFJ root@master
40
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3CkB3Jejavt+yFphsbciktWciJmbcUBOv3ZLPVLW18ZxXGZK
41
vG50EPXo/4By7P6IRW0wCa5YuckQEW+q6kmSatxqJ8e/K9a1mAk13N4f7V7M71Nn8IkujlF3gHYjKrmnEWpGJCy
42
5YBURzywIQTRArlIac1xj2SeM6q+gTMV9WrAKJupIRHli+W0kHVaYHNdKl7KMUT4KVrSl+h4wFwAd7Tcyj7JIbU
43
cCCL6o/v/LqGFwpcJfbfUsuKJJho+tImh41j7mSXR8kRbTSZkcq5KX+iANrANwOHZ58tV5KXmMQjuVq7aJ985C1
44
6hHssB6zq/zjAxpxAyQIeE8Incc8U8ix root@slave1
45
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC//uaMbzbkYqxdgZJSdq+gdQYldzMQ7D3SxsUaNO5oVnVOszw
46
+mbNnmL8vp1EUUehabQHPCAvCmLKUPXzfcxlyJEF/pnY77u4ySwsRVEpHvsDZbrclgCOrS6hW00sSx303KHLOgX
47
T70LfrmnohfUhvTxajzLXT+C8f5ZfTZ8meKD73HKl16jRwZQ8YhW9GUyuCkgQTGtKtTKPsRUd9LpAc/7/u8xvvv
48
NvTYPxgyTJcUMzGSOHh8J3upI54ykY0FgBkjs1fCUaDalxAgsHw9B1iyx706WbcT6ymiQVMKGnnnM6k2KPvUvfD
49
0swVfUSG+4ZsYSRHRTgWuiBbHoIr7DVd root@slave2
50
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDTzTTdGRTd1zts3m7uKobcgRom4lVyF9EdNOdbBWMucYjbCs
51
BgP1ideDDQed2TyBj3Szz3Yx6h1L4McGmATY/D9qRLml26VW/x0Tod8JYkqOQpQL9knLW2cwITnhLzq5VDugOix
52
06r/uweP3Zed9CO7ld3jUxJJNZCYpsNz+eUKq9SWM5+ehUu9pfZZu9zUk7Q01js3uCHzu1AhsajgNzgB4+YLLcc
53
dHBfxGg4ix5wuaF82PlEEh70hTdfRkq8pqPMZ+FIQtTgfD5XllKTcnPItUY23hc7Umx4I3ujOd810vzffWYK07c
54
Otv1r7LEcYtYqbZ6zIvII+M775iRkzQX root@slave3
55
#将master上的authorized_keys文件分发到其他主机上
56
[root@master .ssh]# scp ~/.ssh/authorized_keys root@slave1:~/.ssh/
57
[root@master .ssh]# scp ~/.ssh/authorized_keys root@slave2:~/.ssh/
58
[root@master .ssh]# scp ~/.ssh/authorized_keys root@slave3:~/.ssh/
59
#每台机器之间进行ssh免密码登录操作,包括自己与自己
60
[root@master ~]# ssh master
61
[root@master ~]# ssh slave1
62
[root@slave1 ~]# ssh master
63
[root@master ~]# ssh slave2
64
[root@slave2 ~]# ssh master
65
[root@master ~]# ssh slave3
66
[root@slave3 ~]# ssh master
67
[root@master ~]# ssh slave1
68
[root@slave1 ~]# ssh slave1
69
[root@slave1 ~]# ssh slave2
70
[root@slave2 ~]# ssh slave1
71
[root@slave1 ~]# ssh slave3
72
[root@slave3 ~]# ssh slave1
73
[root@slave1 ~]# ssh slave2
74
[root@slave2 ~]# ssh slave2
75
[root@slave2 ~]# ssh slave3
76
[root@slave3 ~]# ssh slave2
77
[root@slave2 ~]# ssh slave3
78
[root@slave3 ~]# ssh slave2
79
[root@slave2 ~]# ssh slave3
80
[root@slave3 ~]# ssh slave3
4. 安装配置Java环境并测试
         4.1 下载jdk
          4.2 卸载其他jdk
          如果centos中已经安装的有jdk,则需要先卸载当前jdk,重新安装新的jdk
1
#查询当前所有安装的jdk版本
2
[root@master ~]# rpm -qa|grep jdk
3
#如果什么都没有展示说明没有已安装的jdk,则无需卸载,如果出现以下jdk,则卸载之
4
copy-jdk-configs-2.2-3.el7.noarch
5
java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64
6
java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64
7
#卸载jdk,使用下面的方法卸载即可
8
[root@master ~]# yum -y remove copy-jdk-configs-2.2-3.el7.noarch
9
#再次查询当前所有安装的jdk版本
10
[root@master ~]# rpm -qa|grep jdk
          4.3 开始安装jdk
1
#在master主节点上创建指定目录
2
[root@master ~]# mkdir -p /opt/SoftWare/Java
3
[root@master ~]# mkdir -p /opt/SoftWare/Hadoop
4
#进入到Java目录
5
[root@master ~]# cd /opt/SoftWare/Java
6
#使用rz命令从windows主机上传jdk压缩包到master节点
7
[root@master Java]# rz
8
#解压到当前目录
9
[root@master Java]# tar -zxvf jdk-8u152-linux-x64.tar.gz 
10
#配置环境变量
11
[root@master Java]# vi /etc/profile
12
#在该文件后面追加一下内容
13
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152
14
export JRE_HOME=/opt/SoftWare/Java/jdk1.8.0_152/jre
15
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
16
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
17
#使刚才的设置生效
18
[root@master Java]# source /etc/profile
19
#检测是否配置成功
20
[root@master Java]# java -version
21
java version "1.8.0_152"
22
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
23
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
24
#其他主机同样的操作进行即可
5. 安装配置Hadoop并配置
          5.1 下载Hadoop到本地
          5.2 上传至master节点
1
#上传
2
[root@master ~]# cd /opt/SoftWare/Hadoop
3
[root@master Hadoop]# rz
4
#解压
5
[root@master Hadoop]# tar -zxvf hadoop-2.7.5.tar.gz
          5.3 创建目录
1
#进入hadoop-2.7.5主目录
2
[root@master Hadoop]# cd hadoop-2.7.5
3
#创建以下目录,以备后用
4
[root@master hadoop-2.7.5]# mkdir tmp
5
[root@master hadoop-2.7.5]# mkdir logs
6
[root@master hadoop-2.7.5]# mkdir -p hdfs/name
7
[root@master hadoop-2.7.5]# mkdir -p hdfs/data
          5.4 修改配置
          5.4.1 修改 hadoop-env.sh文件
1
[root@master hadoop-2.7.5]# vi etc/hadoop/hadoop-env.sh
2
#修改JAVA_HOME为以下内容,否则容易出现Hadoop无法启动问题
3
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152
          5.4.2 修改 yarn-env.sh文件
1
[root@master hadoop-2.7.5]# vi etc/hadoop/yarn-env.sh 
2
#修改JAVA_HOME为以下内容
3
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152
          5.4.3 编辑slaves文件
1
#该文件用于记录本集群有哪些数据节点
2
[root@master hadoop-2.7.5]# vi etc/hadoop/slaves 
3
#删除该文件中原来的内容,添加以下内容
4
slave1
5
slave2
6
slave3
          5.4.4 修改core-site.xml文件
1
[root@master hadoop-2.7.5]# vi etc/hadoop/core-site.xml
    该文件为Hadoop的核心配置文件,非常重要
1
<!--在<configuration></configuration>中间添加一下内容-->
2
<property>
3
    <name>fs.defaultFS</name><!--定义Hadoop Master的URI和端口-->
4
    <value>hdfs://master:9000</value>
5
</property>
6
<property>
7
    <name>hadoop.tmp.dir</name><!--hadoop的临时存储目录-->
8
    <value>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/tmp</value>
9
</property>
10
<property>
11
    <name>io.file.buffer.size</name><!--用作序列化文件处理时读写buffer的大小-->
12
    <value>131702</value>
13
</property>
          5.4.5 修改 hdfs-site.xml文件
1
[root@master hadoop-2.7.5]# vi etc/hadoop/hdfs-site.xml 
    该文件为Hadoop的HDFS的配置文件
1
<!--在<configuration></configuration>中间添加一下内容-->
2
<property><!--namenode节点数据存储目录-->
3
    <name>dfs.namenode.name.dir</name>
4
    <value>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name</value>
5
</property>
6
<property><!--datanode数据存储目录-->
7
    <name>dfs.datanode.data.dir</name>
8
    <value>file:/opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/data</value>
9
</property>
10
<property><!--指定DataNode存储block的副本数量,不大于DataNode的个数就行,默认为3-->
11
    <name>dfs.replication</name>
12
    <value>2</value>
13
</property>
14
<property><!--指定master的http协议访问地址-->
15
    <name>dfs.namenode.secondary.http-address</name>
16
    <value>master:50090</value>
17
</property>
18
<property><!--指定master的https协议访问地址-->
19
    <name>dfs.namenode.secondary.https-address</name>
20
    <value>192.168.10.250:50091</value>
21
</property>
22
<property><!--必须设置为true,否则就不能通过web访问hdfs上的文件信息-->
23
    <name>dfs.webhdfs.enabled</name>
24
    <value>true</value>
25
</property>
          5.4.6 修改yarn-site.xml文件
1
[root@master hadoop-2.7.5]# vi etc/hadoop/yarn-site.xml
1
<property>
2
    <name>yarn.nodemanager.aux-services</name>
3
    <value>mapreduce_shuffle</value>
4
</property>
5
<property>
6
    <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
7
    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
8
</property>
9
<property>
10
    <name>yarn.resourcemanager.address</name>
11
    <value>master:8032</value>
12
</property>
13
<property>
14
    <name>yarn.resourcemanager.scheduler.address</name>
15
    <value>master:8030</value>
16
</property>
17
<property>
18
    <name>yarn.resourcemanager.resource-tracker.address</name>
19
    <value>master:8031</value>
20
</property>
21
<property>
22
    <name>yarn.resourcemanager.admin.address</name>
23
    <value>master:8033</value>
24
</property>
25
<property>
26
    <name>yarn.resourcemanager.webapp.address</name>
27
    <value>master:8088</value>
28
</property>
29
<property>
30
    <name>yarn.nodemanager.resource.memory-mb</name>
31
    <value>2048</value>
32
</property>
33
          5.4.7 修改mapred-site.xml文件
          但是这个文件并不存在,先复制再打开
1
#使用cp命令复制一份出来,不要自己创建
2
[root@master hadoop-2.7.5]# cp etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml
3
[root@master hadoop-2.7.5]# vi etc/hadoop/mapred-site.xml
1
<property><!--使用yarn运行mapreduce程序-->
2
    <name>mapreduce.framework.name</name>
3
    <value>yarn</value>
4
</property>
5
<property><!--MapReduce JobHistory Server地址-->
6
    <name>mapreduce.jobhistory.address</name>
7
    <value>master:10020</value>
8
</property>
9
<property><!--MapReduce JobHistory Server Web界面地址-->
10
    <name>mapreduce.jobhistory.webapp.address</name>
11
    <value>master:19888</value>
12
</property>
          5.5 文件分发  
          将master节点上的Hadoop目录远程拷贝到其他slave节点
1
[root@master hadoop-2.7.5]# scp -r /opt/SoftWare/Hadoop root@slave1:/opt/SoftWare/
2
[root@master hadoop-2.7.5]# scp -r /opt/SoftWare/Hadoop root@slave2:/opt/SoftWare/
3
[root@master hadoop-2.7.5]# scp -r /opt/SoftWare/Hadoop root@slave3:/opt/SoftWare/
          5.6 修改环境变量
1
#各节点均编辑/etc/profile文件
2
[root@master hadoop-2.7.5]# vi /etc/profile
3
#添加以下内容
4
export HADOOP_HOME=/opt/SoftWare/Hadoop/hadoop-2.7.5
5
export HADOOP_LOG_DIR=$HADOOP_HOME/logs
6
export YARN_LOG_DIR=$HADOOP_LOG_DIR
7
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
8
#使设置立即生效
9
[root@master hadoop-2.7.5]# source /etc/profile
          5.7 格式化Hadoop
1
#输入以下命令
2
[root@master hadoop-2.7.5]# bin/hdfs namenode -format
3
#在最后出现以下内容说明格式化成功
4
18/03/01 10:07:59 INFO namenode.FSImage: Allocated new BlockPoolId: BP-1057357071-192.168.100.100-1519870079201
5
18/03/01 10:07:59 INFO common.Storage: Storage directory /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name has been successfully formatted.
6
18/03/01 10:07:59 INFO namenode.FSImageFormatProtobuf: Saving image file /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name/current/fsimage.ckpt_0000000000000000000 using no compression
7
18/03/01 10:07:59 INFO namenode.FSImageFormatProtobuf: Image file /opt/SoftWare/Hadoop/hadoop-2.7.5/hdfs/name/current/fsimage.ckpt_0000000000000000000 of size 321 bytes saved in 0 seconds.
8
18/03/01 10:07:59 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
9
18/03/01 10:07:59 INFO util.ExitUtil: Exiting with status 0
10
18/03/01 10:07:59 INFO namenode.NameNode: SHUTDOWN_MSG: 
11
/************************************************************
12
SHUTDOWN_MSG: Shutting down NameNode at master/192.168.100.100
13
************************************************************/
14
#注意上面的第二行最后的successfully formatted
          5.8 启动Hadoop集群
1
#先启动HDFS,按照新版要求,不建议直接使用start-all.sh命令
2
[root@master hadoop-2.7.5]# sbin/start-dfs.sh
3
#然后会在控制台打印以下信息
4
Starting namenodes on [master]
5
master: starting namenode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-namenode-master.out
6
slave1: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave1.out
7
slave2: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave2.out
8
slave3: starting datanode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-datanode-slave3.out
9
Starting secondary namenodes [master]
10
master: starting secondarynamenode, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/hadoop-root-secondarynamenode-master.out
11
#然后启动YARN
12
[root@master hadoop-2.7.5]# sbin/start-yarn.sh
13
#然后会在控制台打印以下信息
14
starting yarn daemons
15
starting resourcemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-resourcemanager-master.out
16
slave2: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave2.out
17
slave3: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave3.out
18
slave1: starting nodemanager, logging to /opt/SoftWare/Hadoop/hadoop-2.7.5/logs/yarn-root-nodemanager-slave1.out
          5.9 检测集群是否搭建成功
    5.9.1 使用jps命令查看
1
#master检测
2
[root@master hadoop-2.7.5]# jps
3
44658 ResourceManager
4
44509 SecondaryNameNode
5
44318 NameNode
6
44958 Jps
7
#slave节点检测
8
[root@slave1 ~]# jps
9
2262 DataNode
10
2360 NodeManager
11
2461 Jps
    5.9.2 使用WEB界面访问
    在浏览器地址栏中输入 http://192.168.100.100:50070  即可
    在浏览器地址栏中输入  http://192.168.100.100:8088    即可


6. MySQL数据库的安装
    6.1 下载YUM源rpm安装包
    下载地址: https://dev.mysql.com/downloads/repo/yum/    选择 mysql57-community-release-el7-11.noarch.rpm 下载
1
#下载mysql源
2
[root@master ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
3
#安装mysql源
4
[root@master ~]# yum localinstall mysql57-community-release-el7-11.noarch.rpm 
5
#检测源是否安装成功,显示以下信息表示源安装成功
6
[root@master ~]# yum repolist enabled | grep "mysql.*-community.*"
7
mysql-connectors-community/x86_64        MySQL Connectors Community           45
8
mysql-tools-community/x86_64             MySQL Tools Community                57
9
mysql57-community/x86_64                 MySQL 5.7 Community Server          247
        6.2 安装MySQL
1
[root@master ~]# yum install mysql-community-server
    6.3 启动MySQL服务
1
#启动MySQL服务
2
[root@master ~]# systemctl start mysqld
3
#查看MySQL服务启动状态
4
[root@master ~]# systemctl status mysqld
5
● mysqld.service - MySQL Server
6
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
7
   Active: active (running) since 三 2018-02-28 11:15:52 CST; 14s ago
8
     Docs: man:mysqld(8)
9
           http://dev.mysql.com/doc/refman/en/using-systemd.html
10
  Process: 11568 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
11
  Process: 11495 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
12
 Main PID: 11572 (mysqld)
13
   CGroup: /system.slice/mysqld.service
14
           └─11572 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pi...
15
16
228 11:15:49 test systemd[1]: Starting MySQL Server...
17
228 11:15:52 test systemd[1]: Started MySQL Server.
18
#设置开机自动启动
19
[root@master ~]# systemctl enable mysqld
20
#设置后台自动运行
21
[root@master ~]# systemctl daemon-reload
          6.4 修改root默认密码
1
#在日志文件中查看mysql的root用户默认密码
2
#如下,默认密码为root@localhost:后面的内容,即:itso(d#N>0rK
3
[root@master ~]# grep 'temporary password' /var/log/mysqld.log 
4
2018-02-28T03:15:49.608817Z 1 [Note] A temporary password is generated for root@localhost: itso(d#N>0rK
5
#进入mysql
6
[root@master ~]# mysql -uroot -p
7
#输入密码itso(d#N>0rK
8
#修改密码
9
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
10
#在mysql5.7中必然会出现下面的额错误,原因是因为密码策略问题,密码不能太过简单
11
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
12
#然后可以查看一下密码策略,在此之前先更改一下密码,否则无论你操作什么都会提示你修改密码
13
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '12Zhang.';
14
Query OK, 0 rows affected (0.00 sec)
15
#查看密码策略
16
mysql> show variables like '%password%';
17
+---------------------------------------+--------+
18
| Variable_name                         | Value  |
19
+---------------------------------------+--------+
20
| default_password_lifetime             | 0      |        
21
| disconnect_on_expired_password        | ON     |
22
| log_builtin_as_identified_by_password | OFF    |
23
| mysql_native_password_proxy_users     | OFF    |
24
| old_passwords                         | 0      |
25
| report_password                       |        |
26
| sha256_password_proxy_users           | OFF    |
27
| validate_password_check_user_name     | OFF    | 设为 ON 时密码中不允许包含用户名
28
| validate_password_dictionary_file     |        | 用于验证密码强度的字典文件路径,策略为STRONG才需要
29
| validate_password_length              | 8      | 最小长度为8个字符
30
| validate_password_mixed_case_count    | 1      | 至少1个大小写字母(各一个)
31
| validate_password_number_count        | 1      | 至少1个数字 
32
| validate_password_policy              | MEDIUM | 密码策略,默认为MEDIUM策略
33
| validate_password_special_char_count  | 1      | 至少1个特殊字符
34
+---------------------------------------+--------+
35
#取消密码策略检查
36
#修改/etc/my.cnf文件,在文件中添加以下内容以禁用密码策略
37
validate_password=off
38
[root@master ~]# vi /etc/my.cnf
39
#重新启动mysql服务
40
[root@master opt]# systemctl restart mysqld
41
#再次进入mysql,修改密码
42
[root@master ~]# mysql -uroot -p
43
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
       6.5 修改数据库编码为utf-8
1
#在/etc/my.cnf文件中的[mysqld]内添加以下内容
2
character_set_server=utf8
3
init_connect='SET NAMES utf8'
4
[root@master ~]# vi /etc/my.cnf
          6.6 添加root用户的远程登录权限
         默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户
1
#进入mysql
2
[root@master ~]# mysql -uroot -p123456
3
#修改root的远程访问权限
4
#root代表用户名 , %代表任何主机都可以访问 , 123456为root访问的密码
5
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 
6
#flush privileges刷新MySQL的系统权限,使其即时生效,否则就重启服务器
7
mysql> FLUSH PRIVILEGES;
8
#退出
9
mysql> exit;
7. Hive安装
    为了方便操作Hive的服务端和客户端均安装在master节点上
    7.1 下载
         7.2 上传并解压
1
#创建Hive目录
2
[root@master ~]# mkdir /opt/SoftWare/Hive
3
#进入到Hive目录
4
[root@master ~]# cd /opt/SoftWare/Hive
5
#通过xshell工具上传至master主机
6
[root@master Hive]# rz
7
#解压
8
[root@master Hive]# tar -zxvf apache-hive-2.3.2-bin.tar.gz
9
#修改文件夹的名字
10
[root@master Hive]# mv apache-hive-2.3.2-bin hive-2.3.2
          7.3 配置环境变量
1
#打开配置文件
2
[root@master Hive]# vi /etc/profile
3
#在后面追加以下内容
4
export HIVE_HOME=/opt/SoftWare/Hive/hive-2.3.2
5
export PATH=$PATH:$HIVE_HOME/bin
6
#使设置生效
7
[root@master Hive]# source /etc/profile
    7.4 修改配置文件 hive-site.xml
          该文件不存在,需要复制hive-default.xml .template来创建
1
#进入到hive-2.3.2目录
2
[root@master Hive]# cd hive-2.3.2/
3
#创建hive-site.xml文件
4
[root@master hive-2.3.2]# cp conf/hive-default.xml.template conf/hive-site.xml
5
[root@master hive-2.3.2]# vi conf/hive-site.xml 
6
#创建指定目录
7
[root@master hive-2.3.2]# hadoop fs -mkdir -p /hive/tmp
8
[root@master hive-2.3.2]# hadoop fs -mkdir -p /hive/logs
9
[root@master hive-2.3.2]# hadoop fs -mkdir -p /hive/warehouse
    修改配置如下:
1
<property><!--数据库连接地址,使用MySQL存储元数据信息-->
2
    <name>javax.jdo.option.ConnectionURL</name>
3
    <value>jdbc:mysql://master:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false</value>
4
</property>
5
  <property><!--数据库驱动-->
6
    <name>javax.jdo.option.ConnectionDriverName</name>
7
    <value>com.mysql.jdbc.Driver</value>
8
  </property>
9
  <property><!--数据库用户名-->
10
    <name>javax.jdo.option.ConnectionUserName</name>
11
    <value>root</value>
12
    <description>Username to use against metastore database</description>
13
  </property>
14
<property><!--密码-->
15
    <name>javax.jdo.option.ConnectionPassword</name>
16
    <value>123456</value>
17
    <description>password to use against metastore database</description>
18
  </property>
19
  <property><!--HDFS路径,用于存储不同 map/reduce 阶段的执行计划和这些阶段的中间输出结果。-->
20
    <name>hive.exec.local.scratchdir</name>
21
    <value>/hive/tmp</value>
22
  </property>
23
  <property><!--Hive 查询日志所在的目录,如果该值为空,将不创建查询日志。-->
24
    <name>hive.querylog.location</name>
25
    <value>/hive/logs</value>
26
  </property>
27
  <property><!--本地表的默认位置-->
28
    <name>hive.metastore.warehouse.dir</name>
29
    <value>/hive/warehouse</value>
30
  </property>
31
  <property>
32
    <name>hive.metastore.uris</name><!--Hive连接到该URI请求远程元存储的元数据-->
33
    <value>thrift://master:9083</value>
34
  </property>
35
  <property><!--关闭本地模式,此项不存在,需要自己添加-->
36
     <name>hive.metastore.local</name>
37
     <value>false</value>
38
  </property>
39
  <property>
40
    <name>hive.server2.logging.operation.log.location</name>
41
    <value>/hive/logs</value>
42
  </property>
43
<property>
44
    <name>hive.downloaded.resources.dir</name>
45
    <value>/hive/tmp/${hive.session.id}_resources</value>
46
  </property>
          7.5 修改配置文件
1
[root@master hive-2.3.2]# vi bin/hive-config.sh
2
#添加以下内容
3
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_152
4
export HADOOP_HOME=/opt/SoftWare/Hadoop/hadoop-2.7.5
5
export HIVE_HOME=/opt/SoftWare/Hive/hive-2.3.2
          7.6 复制MySQL的驱动jar到hive/lib目录
1
[root@master hive-2.3.2]# cd lib
2
[root@master lib]# rz
          7.7 对Hive进行初始化并启动Hive
1
[root@master lib]# cd $HIVE_HOME/bin
2
[root@master bin]# schematool -initSchema -dbType mysql
3
#出现以下信息代表初始化成功
4
SLF4J: Class path contains multiple SLF4J bindings.
5
SLF4J: Found binding in [jar:file:/opt/SoftWare/Hive/hive-2.3.2/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
6
SLF4J: Found binding in [jar:file:/opt/SoftWare/Hadoop/hadoop-2.7.5/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
7
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
8
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
9
Metastore connection URL:    jdbc:mysql://master:3306/metastore?createDatabaseIfNotExist=true
10
Metastore Connection Driver :    com.mysql.jdbc.Driver
11
Metastore connection User:   root
12
Sun Mar 04 15:30:33 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
13
Starting metastore schema initialization to 2.3.0
14
Initialization script hive-schema-2.3.0.mysql.sql
15
Sun Mar 04 15:30:34 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
16
Initialization script completed
17
Sun Mar 04 15:30:36 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
18
schemaTool completed
19
#启动hive服务端
20
[root@master bin]# hive --service metastore
21
#启动Hive客户端
22
[root@master bin]# hive
23
#输入show tables;显示以下信息,说明Hive已经启动
24
hive> show tables;
25
OK
26
Time taken: 1.594 seconds
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

aijava1

请我喝咖啡!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值