1.启动mysql服务
[root@localhost ~]# service mysqld start
报错:
Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
[失败]
查看mysql服务的启动日志:
[root@localhost ~]# cat /var/log/mysqld.log
2017-12-07T01:13:17.421614Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)
2017-12-07T01:13:17.421651Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory.
mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
发现mysql服务启动的时候不能创建PID文件。
在终端查看发现果然没有/var/run/mysqld这个文件,所以创建一个:
[root@localhost ~]# mkdir -p /var/run/mysqld
然后再重启mysql的服务,可是还是失败:
[root@localhost ~]# /etc/init.d/mysqld start
Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
[失败]
发现/var/run/mysqld/的属主和属组还是root,mysql并不能在其中创建文件,后修改该目录的属主和属组,启动成功。
[root@localhost ~]# ls -ld /var/run/mysqld/
drwxr-xr-x. 2 root root 40 12月 7 09:53 /var/run/mysqld/
[root@localhost ~]# chown mysql.mysql /var/run/mysqld/
[root@localhost ~]# /etc/init.d/mysqld start
Starting mysqld (via systemctl): [ 确定 ]
重启虚拟机之后打开Ambari页面要开启的服务
首先开启Mysql:
[root@master ~]# mkdir -p /var/run/mysqld
[root@master ~]# chown mysql.mysql /var/run/mysqld/
[root@master ~]# service mysqld start
Starting mysqld (via systemctl): [ OK ]
之后就是http服务:
[root@master ~]# service httpd start
Redirecting to /bin/systemctl start httpd.service
检查配置完整性:
[root@master ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: HDP-2.4 HDP-UTILS-1.1.0.20 Updates-ambari-2.2.1.1 base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@master ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP/centos7/2.x/updates/2.4.0.0/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/HDP-UTILS-1.1.0.20/repos/centos7/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
http://192.168.24.131/AMBARI-2.2.1.1/centos7/2.2.1.1-70/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to 192.168.24.131:80; Connection refused"
Trying other mirror.
base/7/x86_64 | 3.6 kB 00:00:00
base/7/x86_64/group_gz | 156 kB 00:00:00
base/7/x86_64/primary_db | 5.7 MB 00:00:00
extras/7/x86_64 | 3.4 kB 00:00:00
extras/7/x86_64/primary_db | 145 kB 00:00:00
updates/7/x86_64 | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 4.5 MB 00:00:00
repo id repo name status
HDP-2.4 HDP-2.4 0
HDP-UTILS-1.1.0.20 HDP-UTILS-1.1.0.20 0
Updates-ambari-2.2.1.1 ambari-2.2.1.1 - Updates 0
base/7/x86_64 CentOS-7 - Base 9,591
extras/7/x86_64 CentOS-7 - Extras 327
updates/7/x86_64 CentOS-7 - Updates 1,540
repolist: 11,458
最后开启ambari服务:
[root@master ~]# ambari-server start
Using python /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start....................
Ambari Server 'start' completed successfully.