Monthly Archives: February 2020

monitor process io

ps -eo state,pid,cmd | awk '/^D/ { print "proccess: " $3 ; system("cat /proc/"$2"/io") }'

proccess: [md1_raid10]
rchar: 0
wchar: 0
syscr: 0
syscw: 0
read_bytes: 0
write_bytes: 0
cancelled_write_bytes: 0
proccess :/opt/cpanel/ea-php56/root/usr/bin/php-cgi
rchar: 334932
wchar: 3941
syscr: 177
syscw: 26
read_bytes: 4096
write_bytes: 8192
cancelled_write_bytes: 4096

redirect input into dockerfile


docker build -t myimage:latest  -f- . <<EOF
FROM centos
CMD mkdir /app
WORKDIR /app
RUN echo "file contents" > file.txt
EOF

Sending build context to Docker daemon  16.43kB
Step 1/4 : FROM centos
 ---> 470671670cac
Step 2/4 : CMD mkdir /app
 ---> Using cache
 ---> cf9be82aca00
Step 3/4 : WORKDIR /app
 ---> Using cache
 ---> 24baea1f7712
Step 4/4 : RUN echo "file contents" > file.txt
 ---> Using cache
 ---> 61db761dc411
Successfully built 61db761dc411
Successfully tagged myimage:latest

docker run --name ttt -ti -d --privileged=true myimage  "/sbin/init"
docker exec -it ttt cat '/app/file.txt'
file contents


DATABASE ERROR: CONNECTION FAILED! Unable to connect to the database! Please contact your server-administrator.

directadmin DATABASE ERROR: CONNECTION FAILED! Unable to connect to the database! Please contact your server-administrator.

vi /root/.my.cnf
[client]
user=root
password="password"

Make sure mysql user username is set otherwise you will get error wrong da_roundcube password:
Executing database schema update.
ERROR: SQLSTATE[HY000] [1045] Access denied for user 'da_roundcube'@'localhost' (using password: YES)
ERROR: Failed to connect to database

centos install kafka


yum install java wget -y
wget https://downloads.apache.org/kafka/2.4.0/kafka_2.13-2.4.0.tgz
tar xvf kafka_2.13-2.4.0.tgz
mv -v kafka_2.13-2.4.0 /opt/kafka
adduser kafka
chown -R kafka.kafka /opt/kafka

vi /etc/systemd/system/kafka.service

[Unit]
Description=Apache Kafka
Requires=zookeeper.service
After=zookeeper.service

[Service]
Type=simple

User=kafka
Group=kafka

ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh

[Install]
WantedBy=multi-user.target

vi /etc/systemd/system/zookeeper.service

[Unit]
Description=zookeeper
After=syslog.target network.target

[Service]
Type=simple

User=kafka
Group=kafka

ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh

[Install]
WantedBy=multi-user.target

systemctl start kafka zookeeper

Loaded: loaded (/etc/systemd/system/kafka.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-02-18 11:01:54 UTC; 3min 58s ago
Process: 1991 ExecStop=/opt/kafka/bin/kafka-server-stop.sh (code=exited, status=0/SUCCESS)
Main PID: 2014 (java)
Tasks: 64 (limit: 9189)
Memory: 323.1M
CGroup: /docker/a5855c3d46b38df0737879ebf1b5bc90a11d9a2c0604ae3bac810683aeb0e44e/system.slice/kafka.service
└─2014 java -Xmx1G -Xms1G -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Xloggc:/opt/kafka/bin/../logs/kafkaServer-gc.log -verbose>

Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,391] INFO [TransactionCoordinator id=0] Starting up. (kafka.coordinator.transaction.TransactionCoordinator)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,411] INFO [TransactionCoordinator id=0] Startup complete. (kafka.coordinator.transaction.TransactionCoordinator)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,431] INFO [Transaction Marker Channel Manager 0]: Starting (kafka.coordinator.transaction.TransactionMarkerChannelManager)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,579] INFO [ExpirationReaper-0-AlterAcls]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,742] INFO [/config/changes-event-process-thread]: Starting (kafka.common.ZkNodeChangeNotificationListener$ChangeEventProcessThread)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,928] INFO [SocketServer brokerId=0] Started data-plane processors for 1 acceptors (kafka.network.SocketServer)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,935] INFO Kafka version: 2.4.0 (org.apache.kafka.common.utils.AppInfoParser)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,935] INFO Kafka commitId: 77a89fcf8d7fa018 (org.apache.kafka.common.utils.AppInfoParser)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,935] INFO Kafka startTimeMs: 1582023721929 (org.apache.kafka.common.utils.AppInfoParser)
Feb 18 11:02:01 a5855c3d46b3 kafka-server-start.sh[2014]: [2020-02-18 11:02:01,937] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)

● zookeeper.service - zookeeper
Loaded: loaded (/etc/systemd/system/zookeeper.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-02-18 11:01:54 UTC; 3min 58s ago
Process: 2003 ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh (code=exited, status=0/SUCCESS)
Main PID: 2013 (java)
Tasks: 26 (limit: 9189)
Memory: 74.0M
CGroup: /docker/a5855c3d46b38df0737879ebf1b5bc90a11d9a2c0604ae3bac810683aeb0e44e/system.slice/zookeeper.service
└─2013 java -Xmx512M -Xms512M -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+ExplicitGCInvokesConcurrent -Djava.awt.headless=true -Xloggc:/opt/kafka/bin/../logs/zookeeper-gc.log -verbo>

Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,502] INFO maxSessionTimeout set to 60000 (org.apache.zookeeper.server.ZooKeeperServer)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,502] INFO Created server with tickTime 3000 minSessionTimeout 6000 maxSessionTimeout 60000 datadir /tmp/zookeeper/version-2 snapdir /tmp/zookeeper/versio>
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,534] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,545] INFO Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 2 worker threads, and 64 kB direct buffers. (>
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,565] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NIOServerCnxnFactory)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,657] INFO zookeeper.snapshotSizeFactor = 0.33 (org.apache.zookeeper.server.ZKDatabase)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,670] INFO Reading snapshot /tmp/zookeeper/version-2/snapshot.0 (org.apache.zookeeper.server.persistence.FileSnap)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,731] INFO Snapshotting: 0x1d to /tmp/zookeeper/version-2/snapshot.1d (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
Feb 18 11:01:57 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:57,853] INFO Using checkIntervalMs=60000 maxPerMinute=10000 (org.apache.zookeeper.server.ContainerManager)
Feb 18 11:01:58 a5855c3d46b3 zookeeper-server-start.sh[2013]: [2020-02-18 11:01:58,606] INFO Creating new log file: log.1e (org.apache.zookeeper.server.persistence.FileTxnLog)

centos 7 install docker


yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io
systemctl start docker

● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2020-02-18 12:33:55 EET; 12s ago
Docs: https://docs.docker.com
Main PID: 1708 (dockerd)
Tasks: 8
Memory: 44.2M
CGroup: /system.slice/docker.service
└─1708 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Feb 18 12:33:53 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:53.665525062+02:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Feb 18 12:33:53 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:53.665553382+02:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0 }] }" module=grpc
Feb 18 12:33:53 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:53.665569778+02:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Feb 18 12:33:54 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:54.249825464+02:00" level=info msg="Loading containers: start."
Feb 18 12:33:54 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:54.891677093+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set...rred IP address"
Feb 18 12:33:55 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:55.220309512+02:00" level=info msg="Loading containers: done."
Feb 18 12:33:55 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:55.249438236+02:00" level=info msg="Docker daemon" commit=369ce74a3c graphdriver(s)=overlay2 version=19.03.6
Feb 18 12:33:55 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:55.249967901+02:00" level=info msg="Daemon has completed initialization"
Feb 18 12:33:55 centos7.test.local dockerd[1708]: time="2020-02-18T12:33:55.311906207+02:00" level=info msg="API listen on /var/run/docker.sock"
Feb 18 12:33:55 centos7.test.local systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.