ChanaLii

ChanaLii 查看完整档案

填写现居城市  |  填写毕业院校  |  填写所在公司/组织填写个人主网站
编辑
_ | |__ _ _ __ _ | '_ \| | | |/ _` | | |_) | |_| | (_| | |_.__/ \__,_|\__, | |___/ 该用户太懒什么也没留下

个人动态

ChanaLii 提出了问题 · 2018-06-22

安装Cludera Manager ,启动agent的服务失败

启动时提示already running,于是我将其restart,有如下错误

[root@master init.d]# ./cloudera-scm-agent start
cloudera-scm-agent is already running
[root@master init.d]# ./cloudera-scm-agent restart
Usage: grep [OPTION]... PATTERN [FILE]...                  [FAILED]
Try 'grep --help' for more information.

cloudera-scm-agent日志如下:

running for None.
[21/Jun/2018 11:55:01 +0000] 11774 MainThread _cplogging   INFO     [21/Jun/2018:11:55:01] ENGINE Bus STOPPED
[21/Jun/2018 11:55:01 +0000] 11774 MainThread _cplogging   INFO     [21/Jun/2018:11:55:01] ENGINE Bus EXITING
[21/Jun/2018 11:55:01 +0000] 11774 MainThread _cplogging   INFO     [21/Jun/2018:11:55:01] ENGINE Bus EXITED
[21/Jun/2018 11:55:01 +0000] 11774 MainThread agent        INFO     Cleaning up daemon
[21/Jun/2018 11:55:03 +0000] 11774 MonitorDaemon-Reporter __init__     INFO     Couldn't get supervisord metrics: process no longer exists (pid=11792)
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     Stopping agent...
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     No extant cgroups; unmounting any cgroup roots
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     No processes are being managed; Supervisor will shutdown.
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     Shutting down supervisord, pid 11792
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        ERROR    Failed to kill process with pid 11792
Traceback (most recent call last):
  File "/opt/cloudera-manager/cm-5.7.2/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.7.2-py2.7.egg/cmf/agent.py", line 2819, in kill_process
    os.kill(pid, signal.SIGTERM)
OSError: [Errno 3] No such process
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        ERROR    Shutdown callback failed.
Traceback (most recent call last):
  File "/opt/cloudera-manager/cm-5.7.2/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.7.2-py2.7.egg/cmf/agent.py", line 2764, in stop
    f()
  File "/usr/lib64/python2.7/asyncore.py", line 409, in close
    self.socket.close()
  File "/usr/lib64/python2.7/asyncore.py", line 636, in close
    os.close(self.fd)
OSError: [Errno 9] Bad file descriptor
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPING
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('master', 9000)) already shut down
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE No thread running for None.
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPED
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPING
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('master', 9000)) already shut down
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE No thread running for None.
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPED

关注 1 回答 0

ChanaLii 提出了问题 · 2018-06-22

安装Cludera Manager ,启动agent的服务失败

启动时提示already running,于是我将其restart,有如下错误

[root@master init.d]# ./cloudera-scm-agent start
cloudera-scm-agent is already running
[root@master init.d]# ./cloudera-scm-agent restart
Usage: grep [OPTION]... PATTERN [FILE]...                  [FAILED]
Try 'grep --help' for more information.

cloudera-scm-agent日志如下:

running for None.
[21/Jun/2018 11:55:01 +0000] 11774 MainThread _cplogging   INFO     [21/Jun/2018:11:55:01] ENGINE Bus STOPPED
[21/Jun/2018 11:55:01 +0000] 11774 MainThread _cplogging   INFO     [21/Jun/2018:11:55:01] ENGINE Bus EXITING
[21/Jun/2018 11:55:01 +0000] 11774 MainThread _cplogging   INFO     [21/Jun/2018:11:55:01] ENGINE Bus EXITED
[21/Jun/2018 11:55:01 +0000] 11774 MainThread agent        INFO     Cleaning up daemon
[21/Jun/2018 11:55:03 +0000] 11774 MonitorDaemon-Reporter __init__     INFO     Couldn't get supervisord metrics: process no longer exists (pid=11792)
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     Stopping agent...
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     No extant cgroups; unmounting any cgroup roots
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     No processes are being managed; Supervisor will shutdown.
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        INFO     Shutting down supervisord, pid 11792
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        ERROR    Failed to kill process with pid 11792
Traceback (most recent call last):
  File "/opt/cloudera-manager/cm-5.7.2/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.7.2-py2.7.egg/cmf/agent.py", line 2819, in kill_process
    os.kill(pid, signal.SIGTERM)
OSError: [Errno 3] No such process
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 agent        ERROR    Shutdown callback failed.
Traceback (most recent call last):
  File "/opt/cloudera-manager/cm-5.7.2/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.7.2-py2.7.egg/cmf/agent.py", line 2764, in stop
    f()
  File "/usr/lib64/python2.7/asyncore.py", line 409, in close
    self.socket.close()
  File "/usr/lib64/python2.7/asyncore.py", line 636, in close
    os.close(self.fd)
OSError: [Errno 9] Bad file descriptor
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPING
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('master', 9000)) already shut down
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE No thread running for None.
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPED
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPING
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('master', 9000)) already shut down
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE No thread running for None.
[21/Jun/2018 11:55:03 +0000] 11774 Dummy-14 _cplogging   INFO     [21/Jun/2018:11:55:03] ENGINE Bus STOPPED

关注 1 回答 0

ChanaLii 收藏了文章 · 2018-05-24

文件拷贝工具类

package com.manager.util;

import com.sun.org.apache.xpath.internal.operations.Bool;

import java.io.*;

/**
 * 文件帮助类
 */
public class FileUtil {

/**
 * 创建文件夹
 * @param path 文件夹路径
 * @return
 */
public static boolean createFolder(String path){
    File file = new File(path);
    if(file.exists()){
        file.delete();
    }
    Boolean isCreateSuccessful = file.mkdir();
    return isCreateSuccessful;
}


/**
 * 判断文件是否存在(包括文件夹和文件)
 * @param path  文件绝对路径
 * @return  true 文件存在 false 文件不存在
 */
public static Boolean isExist(String path){
    if(path == null)    return false;
    File file = new File(path);
    return file.exists();
}

/**
 * 判断文件路径指向的文件是否存在
 * @param filePath  文件路径
 * @return  true 文件存在 false 文件不存在
 */
public static Boolean isExistFile(String filePath){

    if(filePath == null)    return false;

    File file = new File(filePath);
    if(!file.exists()) return false;
    if(!file.isFile()) return false;
    return true;
}

public static Boolean isExistFolder(String folderPath){
    if(folderPath == null)  return false;
    File file = new File(folderPath);
    if(!file.exists())  return false;
    if(!file.isDirectory()) return false;
    return true;
}

/**
 * 文件复制,将指定的一个文件内容复制到另一个指定的文件中
 * @param sourceFile    待复制的文件
 * @param targetFile    目标文件
 * @return  复制是否成功
 */
public static boolean copyFile(String sourceFile, String targetFile){
    if(!isExistFile(sourceFile))    return false;
    Boolean flag = true;
    InputStream inputStream = null;
    OutputStream outputStream = null;
    File file = new File(sourceFile);
    try{
        inputStream = new FileInputStream(file);
        outputStream = new FileOutputStream(targetFile);
        byte [] bytes = new byte[1024];
        int count;
        while((count = inputStream.read(bytes)) != -1){
            outputStream.write(bytes, 0 ,count);
        }
    }catch(IOException e){
        e.printStackTrace();
        flag = false;
    }finally {
        closeIOStream(inputStream, outputStream);
    }
    return flag;
}

/**
 * 将文件拷贝到特定的目录下,拷贝后的文件名称如果为空,则使用原来的文件名
 * @param file  原文件
 * @param folder  目标目录
 * @param newName   新文件名
 * @return  true 拷贝成功 false 拷贝失败
 */
public static Boolean copyFileToSpecisyFolder(String file, String folder, String newName){
    if(!isExistFile(file)){
        return false;
    }
    InputStream inputStream = null;
    OutputStream outputStream = null;
    Boolean isCopySuccessful = true;
    String oldName = file.substring(file.lastIndexOf("\\") + 1, file.length());
    if(newName == null || "".equals(newName)){
        newName = oldName;
    }
    if(!isExistFolder(folder)){  // 判断指定目录是否存在,如果不存在,则创建相应的目录
        if(folder != null){
            if(!createFolder(folder)){
                return false;
            }
        }
    }
    try{
        inputStream = new FileInputStream(file);
        outputStream = new FileOutputStream(folder + "\\" + newName);
        byte [] bytes = new byte[1024];
        int n ;
        while( (n = (inputStream.read(bytes))) != -1){
            outputStream.write(bytes,0 ,n);
        }
    }catch(IOException e){
        e.printStackTrace();
        isCopySuccessful = false;
    } finally {
        closeIOStream(inputStream, outputStream);
    }
    return isCopySuccessful;
}


/**
 * 关闭IO流
 * @param inputStream   输入流
 * @param outputStream  输出流
 */
public static void closeIOStream(InputStream inputStream, OutputStream outputStream){
    try {
        if(inputStream != null) {
            inputStream.close();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    try {
        if(outputStream != null) {
            outputStream.close();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

}

查看原文

认证与成就

  • 获得 0 次点赞
  • 获得 2 枚徽章 获得 0 枚金徽章, 获得 0 枚银徽章, 获得 2 枚铜徽章

擅长技能
编辑

(゚∀゚ )
暂时没有

开源项目 & 著作
编辑

(゚∀゚ )
暂时没有

注册于 2018-05-12
个人主页被 66 人浏览