PID and PID files and Hadoop change PID file storage location under Linux system

Source: Internet
Author: User


1. Understanding PID:


PID full name is process identification.
PID is the code of the process, and each process has a unique PID number. It is randomly assigned by the process runtime and does not represent a specialized process. The PID does not change the identifier at run time, but when you terminate the program and then run the PID identifier, it will be reclaimed by the system, and it may continue to be assigned to the new running program.


2.pid file
  • Content of the PID file
  • Viewed with the cat command, you can see that there is only one row of content and the ID of the process is logged
  • The role of PID files
  • Prevent multiple copies of a process from starting
  • Principle of PID File
  • When the process runs, it adds a file lock to the. pid file, and only the process that obtains the lock has write access (F_WRLCK), and writes its own PID to the file.
    Other processes that attempt to obtain the lock will automatically exit. 3.Hadoop in PID file storage
  • Brief introduction:
  • The default configuration of the PID file for the related process after Hadoop startup is saved in the/tmp directory, using the stop-all.sh,stop-dfs.sh,stop-yarn.sh script to stop the related process is stopped by the corresponding PID file, and Linux under/tmp The directory has a mechanism for timed cleanup, so to prevent errors such as no namenode to stop when the process is stopped, we should change the location where the process PID file is stored.
  • Change method:
    
    
    
    
    [[email protected] ~]$ mkdir -p /opt/software/hadoop-2.8.1/pids
    [[email protected] ~]$ jps
    10512 ResourceManager
    8018 Jps
    10004 SecondaryNameNode
    9655 NameNode
    9806 DataNode
    10623 NodeManager
    [[email protected] ~]$ cd /opt/software/hadoop-2.8.1/sbin/
    [[email protected] sbin]$ ./stop-dfs.sh
    [[email protected] sbin]$ ./stop-yarn.sh
    [[email protected] sbin]$ vi hadoop-daemon.sh
    HADOOP_PID_DIR=/opt/software/hadoop-2.8.1/pids
    [[email protected] sbin]$ vi yarn-daemon.sh
    YARN_PID_DIR=/opt/software/hadoop-2.8.1/pids
    [[email protected] sbin]$ ./start-dfs.sh
    [[email protected] sbin]$ ./start-yarn.sh
    [[email protected] sbin]$ jps
    9201 SecondaryNameNode
    9425 ResourceManager
    9540 NodeManager
    9828 Jps
    8852 NameNode
    8973 DataNode
    #Found that the pid is stored in a new location
    [[email protected] sbin]$ cd /opt/software/hadoop-2.8.1/pids/
    [[email protected] pids]$ ll
    total 20
    -rw-rw-r-- 1 hadoop hadoop 5 May 22 20:14 hadoop-hadoop-datanode.pid
    -rw-rw-r-- 1 hadoop hadoop 5 May 22 20:14 hadoop-hadoop-namenode.pid
    -rw-rw-r-- 1 hadoop hadoop 5 May 22 20:14 hadoop-hadoop-secondarynamenode.pid
    -rw-rw-r-- 1 hadoop hadoop 5 May 22 20:15 yarn-hadoop-nodemanager.pid
    -rw-rw-r-- 1 hadoop hadoop 5 May 22 20:15 yarn-hadoop-resourcemanager.pid


PID and PID files and Hadoop change PID file storage location under Linux system


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.