Category Archives: How to Fix

Docker was unable to connect to the docker daemons

Docker Can’t Connect to Docker Daemon
After I update my Docker version to 0.8.0, I get an error message while entering sudo Docker version : when I update my Docker version to 0.8.0, I received an error message when I entered sudo docker version :

Client version: 0.8.0
Go version (client): go1.2
Git commit (client): cc3a8c8
2014/02/19 12:54:16 Can't connect to docker daemon. Is 'docker -d' running on this host?

And I’ve followed the instructions And entered command sudo docker-d , And I got this: I went into the command sudo docker-d , And I got this:

[/var/lib/docker|2462000b] +job initserver()
[/var/lib/docker|2462000b.initserver()] Creating server
open /var/lib/docker/aufs/layers/cf2414da53f9bcfaa48bc3d58360d7f1cfd3784e4fe51fbef95197709dfc285d: no such file or directory[/var/lib/docker|2462000b] -job initserver() = ERR (1)
2014/02/19 12:55:57 initserver: open /var/lib/docker/aufs/layers/cf2414da53f9bcfaa48bc3d58360d7f1cfd3784e4fe51fbef95197709dfc285d: no such file or directory

How do I solve the problem? how do I solve this problem?


# 1/f,
Reference: https://stackoom.com/question/1Tlln/Docker cannot connect to the docker daemon


# 2 floor
Do a ps aux>4 grep docker Do a ps aux>5 grep docker ps aux>6 grep docker0 to see if the daemon is running.1 2 3 ps aux>7 grep Docker to see if the daemon is running. If not run /etc/init.d/docker start If not run /etc/init.d/docker start


The # 3 floor
I had the same problem – “Can’t connect to docker daemon.” I had the same problem – “Can’t connect to docker daemon.” (except I didn’t get any ‘file not found’ errors on trying to start the server.) (except I didn’t get any ‘file not found’ errors on trying to start the server.)
‘ps’ showed that “/usr/bin/ docker-d “was still running ‘ps’ showed “/usr/bin/ docker-d” was still running
I realised that I “d never later succeeded in running the server myself Mr. I realized that I never really succeeded in running the server. Every attempt had produced each attempt produced

...
2014/03/24 21:57:29 pid file found, ensure docker is not running or delete /var/run/docker.pid

So I belatedly realised that installing docker had maybe registered the daemon with upstart, which had started it for me. So I belatedly realized installation docker may have already registered with the upstart daemon, this has already started it for me. Hence, trying to kill the daemon to manually restart it fails (operation not permitted). so, try to terminate the daemon to manually restart it failed (operation is not allowed). So I did a So I did a So I made a

sudo kill -9 <PID>

on the daemon process. on the daemon. Another daemon immediately took its place, and this new one DOES now let my CLI client connect: Another daemon now lets my CLI client connect:

$ sudo docker info
Containers: 0
Images: 0
Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Dirs: 0
WARNING: No memory limit support
WARNING: No swap limit support

# 4 floor
I have similar problem. I have similar problem. I had to logout and login again to shell because I have just installed Docker and following command didn’t show in my environment. I had to logout and login the shell again because I had just installed Docker and the following commands were not shown in my environment.

export DOCKER_HOST=127.0.0.1:4243 >> ~/.bashrc

The # 5 floor
The best way to find out according to Docker isn ‘t working will be to run The daemon manually. find The Docker not work is The best way to manually run daemons.

$ sudo service docker stop
$ ps aux | grep docker  # do this until you don't see /usr/bin/docker -d
$ /usr/bin/docker -d

The Docker daemon logs to STDOUT, so it will start spitting out whatever it’s doing. Docker daemon logs to STDOUT, so it will start spitting out whatever it’s doing.
Here was what my problem was: this is my problem :

[8bf47e42.initserver()] Creating pidfile
2015/01/11 15:20:33 pid file found, ensure docker is not running or delete /var/run/docker.pid

This was because the instance had been cloned from another virtual machine. This is because the instance has been cloned from another virtual machine. I just had to remove the pidfile, and everything worked afterwards. I just need to delete the pidfile, and everything worked afterwards.
Of course, instead of blindly assuming this will work, I ‘d suggest running the daemon manually one more time and reviewing the log output for any other errors before starting the service back up. of course, I suggest that don’t blindly assume that this will be effective, I suggest to manually run again daemon, And check the log output for any other errors before starting the service backup.


# 6 building
, I got the same problem., , I got the same problem. In CentOS 6.5: In CentOS 6.5:

ps aux |grep `cat /var/run/docker.pid`

If it shows no Docker daemon exists, then I type: If it shows no Docker daemon exists, then I type:

docker -d

and Then press Ctrl + D0 to stop Docker. Because we use the -d option, Docker will run as daemon. Because we use the -d option, Docker will run as daemon. Now we can do: Now we can do:

service docker start

Then I can do a docker pull centos. Then I can do a docker pull centos. That’s all. .
NOTE: If these do not work, you can try yum update, and then repeat these again, because I yum install before these. NOTE: If these don’t work, you can try yum update and then repeat these as I did before yum install.

Syntax error: unexpected character after line continuation character

print(‘ b ‘\xe5\x9c\ x93\xe7\x8e\ xe6\x97\xb6’. Decode ‘GBK’)
SyntaxError:
SyntaxError: unexpected character after line character
Modify it:
Print (b ‘\xe5\x9c\xa3\ x98\x93\xe7\x8e\ xe6\x97\xb6’. Decode ‘GBK’)
passed.
turned out to be the result of the addition of an extra pair of ‘s to b’ \xe5\x9c\ xe6\ x93\xe7\x8e\ xe6\x97\xb6 ‘.

Under Ubuntu environment, eclipse writes C program, and error starting process is reported

Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI C Project: Hello Word ANSI I checked a lot of places and did what everyone said, but nothing worked. Finally in the inspired by http://stackoverflow.com/questions/11390163/running-ubuntu-eclipse-c-helloworld. I installed a dual system, and I set the default working directory of Eclipse to the E disk under Windows (there is also a Chinese directory inside, I don’t know if this makes a difference). And then you keep reporting this error. I changed the directory under Ubuntu so I didn’t make any mistakes.

Error: cannot find module ‘mongoose’

When you enter the command NPM start to start the project, sometimes you will encounter such Error Error: Cannot find module ‘mongoose’, missing the module mongoose.

Error: Cannot find module 'mongoose'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\loginproject\routes\index.js:3:16)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Program Files\nodejs\node_cache\_logs\2019-01-09T01_53_44_235Z-debug.log

The solution at this point is to install the missing module:

npm install mongoose

Run successfully, open the browser to enter the access address, you can see the project.

Girl when she was the original author: qi technology blog: https://www.jianshu.com/u/05f416aefbe1
90 front after sister, love programming, love, love.
stick to summarize the technical problems encountered in the work, keep a record of what you think and see in the work, for the blog above there are no questions, you can join the qq group to ask me: 473819131.

Solve the interceptor calling service layer to display null pointer.

When springBoot lets the interceptor, the interceptor object does not use the New interceptor object, but instead USES bean injection.


@Configuration
public class WebAppConfigurer implements WebMvcConfigurer {

    @Autowired
    private AuthorizationInterceptor authorizationInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authorizationInterceptor).addPathPatterns("/**");

    }

}


 

Vue element El input search to achieve anti shake @ input event requests frequently

Do not use the @input event of EL-input, use this event, use buffering does not work. The actual code is as follows:

<template>
 <el-input suffix-icon="el-icon-search" v-model="page.searchCode" clearable></el-input>
</template>
<script>
	data() {
	    return {
	      timer: '',
	      page:{
	      	searchCode:''
	      }
	    }
	  },
	  watch: {
	    'page.searchCode': {
	      deep: true,
	      handler(newVal, oldVal) {
	        // if (newVal.trim().length !== 0) {
	         //this.getList is a method called after a delay of 500ms.
	        this.debounce(this.getList, 500) 
	        // }
	      }
	    }
	  },
	  methods: {
	    debounce(fn, wait) {
	      if (this.timer !== null) {
	        clearTimeout(this.timer)
	      }
	      this.timer = setTimeout(fn, wait)
	    }
	  },
	  getList(){}//The request can be written in here.
	}
</script>

Springboot starts, closes, and restarts scripts as jar packages

Springboot starts, closes, and restarts scripts in Linux as jar packages
Start the
Write the startup script startup.sh

#!/bin/bash
echo Starting application 

/ etc/profile

nohup java -jar test.jar &

authorization

chmod +x startup.sh

Shut down
Write the close script stop.sh

#!/bin/bash
PID=$(ps -ef | grep test.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
    echo Application is already stopped
else
    echo kill $PID
    kill $PID
fi

authorization

chmod +x stop.sh

restart
Write the restart script restart. Sh

#!/bin/bash
echo Stopping application
source ./stop.sh
echo Starting application
source ./startup.sh

authorization

chmod +x restart.sh

Java jar close startup script

    Java jar close startup script
#!/bin/sh
RESOURCE_NAME=maf.jar
CONFIG_PATH=/maf/maf-service
#Stop
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill -15 $tpid
fi
sleep 5
#Closed
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill -9 $tpid
else
echo 'Stop Success!'
fi

tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
    echo 'App is running.'
else
    echo 'App is NOT running.'
fi

rm -f tpid
nohup java -Dspring.config.location=$CONFIG_PATH/application.properties -jar $RESOURCE_NAME > nohup.out 2>&1 &
echo $! > tpid
echo Start Success!
tail -f nohup.out

Note: 1. -dspring.config. location: Specify the configuration file
For yML type configuration files, you simply place them in the sibling directory of the JAR without specifying them
2. Grep -v Grep eliminates the row
Dlogging.config=/data/apps/maf/ maf-Yunyan /logback.xml

Python: What’s Virtualenv

The Python virtualenv
Install VirtualEnv2.1 Install Virtualenv2.2 Create virtual Environment 2.3 Activate/exit virtual Environment
3. TIps

1. What is VirtualEnv
Virtualenv is short for Virtual Environment, meaning a virtual environment.
so what’s good about python using it?Some!
suppose I did A project A before, using Django2.2. Now that there is a new version of Django3.1, I want to use the latest version of Django. The problem is that I installed the new version of Django, and project A using the old version may not run smoothly.
this is where virtualenv comes in. It can create multiple virtual environments simultaneously, allowing multiple versions of Django to exist on a single computer.
2. Install VirtualEnv
2.1 install virtualenv

pip install virtualenv

2.2 Create a virtual environment
Create a virtual environment.
command format:
virtualenv+ environment name


virtualenv test_env1
virtualenv test_env2

2.3 Activate/exit the virtual environment
Enter the virtual environment, and then you can install the package in the virtual environment.

Win:
	Run\Scripts\activate access a virtual environment
	Run\Scripts\deactivate exit a virtual environment

3. TIps
There is no package installed in the virtual environment and a re-pip is required. The Python interpreter is in the /Scripts/ Python.exe directory.

Pit encountered by entity class data type BigDecimal

Scene:
The price data type in the database is Decimal, and the price data type in entity class A is BigDecimal. When it is necessary to use equals method to compare the A1 object passed from the front end with the A2 object quashed from the database, the result is false even if the object attributes are the same.
why
Debug found that the price value of the object A1 passed from the front end was 0.1 after JSON transformation, while the price value of the a2 object query from the database was 0.1000. Alt + INSERT equals method was used to call the EQUALS method of BigDecimal.

        BigDecimal a = new BigDecimal("1.0");
        BigDecimal b = new BigDecimal("1.00");
        System.out.println(a.compareTo(b) == 0 );  // true
        System.out.println(a.equals(b));  // false

The equals method of BigDecimal compares precision and values, while the compareTo method only compares values.
The solution

 @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ProProductSkuEntity that = (ProProductSkuEntity) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(productId, that.productId) &&
                compareBigDecimal(price, that.price);
    }

    public boolean compareBigDecimal(BigDecimal a, BigDecimal b) {
        return (a == b) || (a != null && a.compareTo(b) == 0);
    }

Modify the equals method overwritten in the entity class, customize the compareBigDecimal method, use compareTo to compare values of the BigDecimal type, and you can also put this method in the utility class.

Request cannot get static resource

Today, I set up the development environment of sprintMVC+MyBatis, but I can’t load the static resource file. After checking relevant materials, I found that my web-.xml configuration is as follows, so that the DispatcherServlet will intercept all requests (.js.css…). There is no corresponding processing method in the controller, so the required files cannot be loaded

<!-- Set Spring DispatchServlet -->
    <servlet>
        <servlet-name>SpringMVC</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring/spring-mvc.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>SpringMVC</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

Then change the configuration of the URl-pattern to *.do to intercept only requests from.do, and you can access the resource file

<servlet>
        <servlet-name>SpringMVC</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring/spring-mvc.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>SpringMVC</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

 

Backup and recovery – rman4

RMAN manual allocation of parallel channels

The article directories
RMAN manual allocation of parallel channels 1. View data file temporary file location 2. Manual channel allocation 3. How to set parallelism to 3

1. View temporary file location of data file

RMAN> report schema;

Report of database schema for database with db_unique_name PROE

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    750      SYSTEM               ***     /u01/app/oracle/oradata/proe/system01.dbf
2    600      SYSAUX               ***     /u01/app/oracle/oradata/proe/sysaux01.dbf
3    90       UNDOTBS1             ***     /u01/app/oracle/oradata/proe/undotbs01.dbf
4    6        USERS                ***     /u01/app/oracle/oradata/proe/users01.dbf
5    346      EXAMPLE              ***     /u01/app/oracle/oradata/proe/example01.dbf
6    20       TEST_1               ***     /u01/app/oracle/oradata/proe/test_1.dbf
7    100      TBS_TRAN             ***     /u01/app/oracle/oradata/proe/tbs_tran01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    29       TEMP                 32767       /u01/app/oracle/oradata/proe/temp01.dbf

2. Manually assign channels

RMAN> run{
2> allocate channel ch1 device type disk format '/u01/app/backup/tbs_%U';
3> backup tablespace TBS_TRAN;
4> release channel ch1;
5> }

allocated channel: ch1
channel ch1: SID=1144 device type=DISK

Starting backup at 10-AUG-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/u01/app/oracle/oradata/proe/tbs_tran01.dbf
channel ORA_DISK_1: starting piece 1 at 10-AUG-20
channel ORA_DISK_1: finished piece 1 at 10-AUG-20
piece handle=/u01/app/oracle/fast_recovery_area/PROE/backupset/2020_08_10/o1_mf_nnndf_TAG20200810T140602_hm1rybq5_.bkp tag=TAG20200810T140602 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-AUG-20

3. How to set the parallelism of 3



RMAN> run{
2> allocate channel ch1 device type disk format '/u01/app/backup1/bak1_%U';
3> allocate channel ch2 device type disk format '/u01/app/backup2/bak2_%U';
4> allocate channel ch3 device type disk format '/u01/app/backup3/bak3_%U';
5> backup 
6> (datafile 1 channel ch1)
7> (datafile 2,3 channel ch2)
8> (datafile 4,5,7,8,9,14 channel ch3);
9> release channel ch1;
10> release channel ch2;
11> release channel ch3;
12> }