The Linux server time is not synchronized caused by:
yum install- y ntpdate ntpdate ntp3.aliyun.com
The Linux server time is not synchronized caused by:
yum install- y ntpdate ntpdate ntp3.aliyun.com
How to Solve Linux Error: -bash: unzip: command not found
Problem:
Unzip the .zip file under Linux and report an error
-bash: unzip: command not found
Solution:
yum install unzip zip
Encountered the above-mentioned bug in production today:
When the system variable innodb_large_prefix is enabled, for InnoDB tables that use DYNAMIC or COMPRESSED row format, the index key prefix is limited to 3072 bytes. If innodb_large_prefix is disabled, no matter what table it is, the index key prefix is limited to 767 bytes.
The above bug is obviously that the index exceeds the limited length of 767 (innodb_large_prefix is disabled in our production):
I found that the table where the error was reported has established a varchar type index, varchar(255). I think there is no problem. In fact, it is not. The above 767 is a byte, and the varchar type is a character. At the same time, I found that the character set I used is ( utf8mb4), this means that the maximum number of bytes per character is 4, so it is obvious that 4*255> 767
So the above error was reported (Specified key was too long; max key length is 767 bytes).
Solution:
Change the number of characters in varchar, I changed it to 64. varchar(64)
Or enable innodb_large_prefix, then the limit value will increase to 3072
As in the question, the error “Failed to clean project: Failed to delete” is reported when running the maven project. The reason is that the previously compiled project is still running and cannot be cleaned, which makes the maven life cycle unable to continue.
The solution is as follows:
Close the current eclipse console, as shown below:
After closing the console, the last running console will appear, just stop running:
Re-run the maven project and the problem is solved.
The error may be caused by an es error, which can be determined by viewing the system log: elasticsearch exception: type=cluster_block_exception, reason=blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];
The reason for this error is that when the disk space is less than 85%, the default value is 85%, which means that Elasticsearch will not allocate fragments to nodes that use more than 85% of the disk. All the above errors will be reported.
The solution to this error:
Since the es container has already been mapped, there is no need to enter the container and execute the reset all index instructions outside.
curl -XPUT -H “Content-Type: application/json” http://127.0.0.1:9200/_all/_settings -d'{“index.blocks.read_only_allow_delete”: null}’
Generally, when we use the ifnull() method, it is similar to the following statement:
IFNULL(expr1,expr2)
If expr1 is not NULL, IFNULL() returns expr1, otherwise it returns expr2. IFNULL() returns a number or string value
select ifnull(name,’no name’) from person;
Convert the null in the query result to the specified string, but in fact, you can also use ifnull() in the where query part:
select * from person where ifnull(name,’no name’)=’no name’;
This kind of use seems a bit stupid, but in some applications it can reduce the amount of code very well.
I turned on centos7 today. Since I did not set the boot-up auto-start, when I started docker, I found that docker-related commands would report errors. Baidu has said that I have tried reinstalling docker, but I still can’t solve the problem. Post a set of questions:
1. For example, I check the version information
2. Restart the container
3. Systemctl status docker Checking the docker status also found an error:
The final solution to the problem is:
enter /etc/docker, create a new one without a daemon.json file:
cd /etc/docker
Edit the daemon.json file:
add this code:
{
“registry-mirrors”: [“https://registry.docker-cn.com”]
}
Then restart docker:
When systemctl restart docker.service
uses the docker command again, there is no problem.
I hope this method is useful for you.
The root of the problem: This is usually because the environment has changed after running the NPM installation.
Run “NPM Rebuild Node SASS-Mandatory” to build bindings for the current environment.
How to solve: Run at this time and follow the prompts to execute the npm rebuild node-sass
command
(If it doesn’t work, run the npm install node-sass
command first)
Then run the node command to start the service
Error message: Job for docker.service failed because the control process exited with error code. See “systemctl status docker.service” and “journalctl -xe” for details.
Environment: The local environment is the Centos7 system installed on VirtualBox.
Docker service status: According to the prompt, use the command systemctl status docker.service to check the status of the docker service, and find the following status information:
Solution: Uninstall docker and reinstall the new docker.
Solution steps:
1. Uninstall Docker. Uninstall the old version of docker without success.
(1) View installed packages: yum list installed | grep docker
Old versions installed on this machine: docker.x86_64, docker-client.x86_64, docker-common.x86_64
(2) Delete the installed Docker-related software packages:
yum -y remove docker.x86_64
yum -y remove docker-client.x86_64
yum -y remove docker-common.x86_64
2. Install Docker
(1) Check the kernel version [Docker requires the kernel version of the Centos system to be higher than 3.10]
uname -r [The kernel version of this machine: 3.10.0-327.el7.x86_64]
(2) Update the yum package to the latest (the time may be a bit long, wait slowly…)
yum update
(3) Install the required software packages. [Yum-util provides the yum-config-manager function, the other two are required by the devicemapper driver]
yum install -y yum -utils device-mapper-persistent-data lvm2
(4) Set yum source
yum install -y yum -utils device-mapper-persistent-data lvm2
(5) View the docker version of the warehouse
yum list docker-ce –showduplicates | sort -r
(6) Install docker
yum install docker-ce
(7) Start docker, set to start docker at boot.
systemctl start docker
systemctl enable docker
systemctl stop docker [Supplement: This is the command to close docker]
(8) View version
docker version
(9) To check whether the startup is successful, you can use the search command.
docker search mysql
(10) View log status
systemctl status docker.service
1. The space, tab key and enter key encountered before the next() method encounters a valid character cannot be used as a terminator, the next() method will automatically remove it, only when the next() method encounters a valid character After that, the next() method treats the space key, Tab key, or Enter key entered later as a separator or terminator, so next() cannot get the string with spaces, only part of the string (space front).
2. The terminator of the nextLine() method is the Enter key, that is, the nextLine() method returns all the strings before the Enter key, so the nextLine() method can get the string with spaces.
java.lang.IllegalArgumentException: Property’dataSource’ is required
When I was working on a travel website today, I encountered an exception. The console showed that there was an error when creating the JdbcTemplate object. After inspection, it was found that the code in the custom JDBCUtils tool class
InputStream is = JDBCUtils.class.getClassLoader( ).getResourceAsStream(“druid.properties”);
Add one more / to the configuration file path inside, just remove /; or the durid.properties file is placed in the wrong location, the correct one is to put it in the src directory, not The directory of the project.
There are two reasons for the mingw path in Chinese or there are multiple mingw locally. Just delete the others.