Help Center> MapReduce Service> Troubleshooting> Using Flink> Flink Service Program Fails to Read Files on the NFS Disk
Updated on 2023-11-30 GMT+08:00

Flink Service Program Fails to Read Files on the NFS Disk

Issue

The Flink service program cannot read files on the NFS disk mounted to the cluster node.

Symptom

The Flink service program developed by a user needs to read the user-defined configuration file. The configuration file is stored on the NFS disk. The NFS disk is mounted to the cluster node and can be accessed by all nodes in the cluster. After the user submits the Flink program, the service code cannot access the user-defined configuration file. As a result, the service program fails to be started.

Cause Analysis

The root cause is that the permission on the root directory of the NFS disk is insufficient. As a result, the Flink program cannot access the directory after being started.

Flink tasks of MRS are running on Yarn. If Kerberos authentication is not enabled for the cluster, the user who runs the tasks on Yarn is yarn_user. If the user-defined configuration file is used after the tasks are started, yarn_user must be allowed to access the file and the parent directory of the file (parent directory of the file on the NFS, not the soft link on the cluster node). Otherwise, the program cannot obtain the file content. If Kerberos authentication is enabled for the cluster, the file permission must allow the user who submits the program to access the file.

Procedure

  1. Log in to the master node in the cluster as user root.
  2. Run the following command to check the permission on the parent directory of the user-defined configuration file:

    ll <Parent directory of the file path>

  3. Go to the directory of the file to be accessed on the NFS disk and change the permission of the parent directory of the user-defined configuration file to 755.

    chmod 755 -R /<Parent directory of the file path>

  4. Check whether the core or task node can access the configuration file.

    1. Log in to the core or task node as user root.

      If Kerberos authentication is enabled for the current cluster, log in to the core node as user root.

    2. Run su - yarn_user to switch to user yarn_user.

      If Kerberos authentication is enabled for the cluster, run the su - User who submits the job command to switch the user.

    3. Run the following command to check the user permission. The file path must be the absolute path of the file.

      ll <File path>

Summary and Suggestions

When a user-defined configuration file needs to be accessed in the submitted task, especially when the NFS disk is mounted, you need to check whether the permission of the parent directory of the file is correct in addition to the file permission. When an NFS disk is mounted to an MRS cluster node, a soft link is created to the NFS directory. In this case, you need to check whether the directory permission on the NFS is correct.