In Python, `os.makedirs()` with 0777 mode does not give others write permission

In Python, os.makedirs() with 0777 mode can not give others write permission The code is as follows $ python Python 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2 Type “help”, “copyright”, “credits” or “license” for more information. >>> import os >>> os.makedirs(“/tmp/test1/test2”, 0777) >>> The created dirs are not […]

How to check interrupts lively in your systems?

I need to see what kind of interrupts are handled by which CPU. Please run command: # cat /proc/interrupts or you can execute $ watch -n1 “cat /proc/interrupts” to watch interrupts every 1 second. See [1] [2] for more details. References: [1] [2] Answered by harryxiyou.

How to force a checkpointing of metadata in HDFS?

HDFS SecondaraNameNode log shows 2017-08-06 10:54:14,488 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in doCheckpoint Inconsistent checkpoint fields. LV = -63 namespaceID = 1920275013 cTime = 0 ; clusterId = CID-f38880ba-3415-4277-8abf-b5c2848b7a63 ; blockpoolId = BP-578888813- Expecting respectively: -63; 263120692; 0; CID-d22222fd-e28a-4b2d-bd2a-f60e1f0ad1b1; BP-622207878- at org.apache.hadoop.hdfs.server.namenode.CheckpointSignature.validateStorageInfo( at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doCheckpoint( at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doWork( at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$ at at It seems the checkpoint […]

How to tune systems to achieve high performance in virtualization circumstances?

Most time, we need to tune system parameters to achieve better performance but what the general parameters to be tuned in Linux systems. I think you may want to add following parameters to Kernel boot (/etc/default/grub) parameters intel_idle.max_cstate=0 processor.max_cstate=0 idle=poll intel_pstate=disable At the same time, you may also want to shutdown/open Pause Loop Exiting (PLE). […]

How to install gfortran on CentOS 7?

How to install the gfortran fortran compiler on CentOS 7 Linux? gfortran on CentOS 7 is provided in the gcc-gfortran package. You may install it to install gfortran. # yum install gcc-gfortran Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: * epel: * extras: * nux-dextop: * […]

Why “ValueError: zero length field name in format” error in Python on CentOS 6?

The same Python program runs without any problem while it report ValueError: zero length field name in format error in Python on CentOS 6 The piece of code in Python is: print ‘== {} SPF’.format(d) Why “ValueError: zero length field name in format” error in Python on CentOS 6? This feature of {} without the […]

How to get vCPU thread ID in QEMU/KVM host OS?

In order to collect more information about CPU information internal guest OS, we usually need to get vCPU’s thread ID in host OS. Solution 1: Under directory ‘/sys/fs/cgroup/cpuset/machine’, you will find virtual_machine_name.libvirt-qemu directory. And under this directory, you will find all vCPU sub-directories and under these dirs, you will find vCPU thread IDs. For example […]

How to limit a user’s CPU resources in Linux Systems

When you use a server with other users, you might want to limit other users’ CPU resources for some specific aims. Cgroup has lots of parameters we can use to control computer resources. For CPU resources, you can tune cpu.shares parameter to limit users’ CPU resources. To be more precise, change directory to /sys/fs/cgroup/cpu/user and […]

How to get processes’ I/O utilization percentage

Two notices: 1, a process has only one main thread which is itself. 2, a process has many threads. Solution 1: Please use taskstats [1] related interfaces, and send TASKSTATS_TYPE_PID and TASKSTATS_TYPE_TGID commands to kernel to get a process’s ‘blkio_delay_total’ parameter for a process with one main thread and a process with threads separately. Solution […]

How to add PHP DOMDocument extension to httpd in CentOS 7?

Just migrated a PHP site to a new server. However, in /var/log/httpd/error_log, there are errors like [:error] [pid 2810] [client] PHP Fatal error: Class ‘DOMDocument’ not found in /var/www/…/some.php on line 16 How to add PHP DOMDocument extension to httpd in CentOS 7? You need to install the package php-xml to have DOMCoument support […]

Where is MySQL / MariaDB storage location by default on CentOS 7?

Where is MySQL / MariaDB storage location by default on CentOS 7? No special configuration to the MariaDB from official repository of CentOS. On CentOS 7 Linux it is usually by default /var/lib/mysql But here I give you another “hacky” way to find it out. The method is to find out the mysql daemon mysqld’ […]