Category Archives: Linux

[Solved] ModuleNotFoundError: No module named ‘MySQLdb’

Resolve modulenotfounderror: no module named ‘mysqldb’

System: Ubuntu 18.04

First, check the error reports:

There are two ways to Solve this error:

One is to use pymysql and add two lines of code, but because the code has been uploaded to the server and the modification is complex, the second method is adopted: install mysqlclient, and execute the following command:

pip3 install mysqlclient

report errors:

After Google again, I found that libmysqlclient dev needs to be installed first

apt-get install libmysqlclient-dev

PIP installation again, successful!

[Solved] Git clone Error: fatal: Protocol ‘HTTPS’ is not supported

Git problem: git clone encountered fatal: Protocol ‘HTTPS’ is not supported problem solution

Reappearance

An error is reported when the clone command is executed in Git bash in Windows protocol ''https'' is not supported

reason

When pasting the address, we use Ctrl + V, which has no effect in Git bash. Then we will use paste in the right-click menu, but unfortunately, using Ctrl + V will add a hidden symbol ^?In Git Bash.

In Git bash, your clone statement may display as normal:

git clone https://gitee.com/qianfanguojin/homework_1.git

But the real statement is as follows:

git clone ^?https://gitee.com/qianfanguojin/homework_1.git

There are more symbols in front of the link, and the protocol becomes ^ HTTPS, which must not be cloned successfully, indicating that the protocol is not supported.

Solution:

Delete the space before HTTPS, and enter the space manually

[Solved] java.lang.NoClassDefFoundError: net/sf/jsqlparser/expression/Expression

When deploying the springboot project with dcoker, the query list will report errors. The exception information is as follows:

After analyzing the cause, we know that it is the jsqlparser version problem. For versions below 1.0 (including 1.0), there is an error when querying the data from the database for parsing.

You need to upgrade its version. Here you can upgrade to version 4.0 directly:

<dependency>
    <groupId>com.github.jsqlparser</groupId>
    <artifactId>jsqlparser</artifactId>
    <version>4.0</version>
</dependency>

Of course, this exception will also occur when using the PageHelper of GitHub’s paging plug-in. The reason is that it introduces jsqlparser, so you need to upgrade the version of the paging plug-in:

<dependency>
      <groupId>com.github.pagehelper</groupId>
      <artifactId>pagehelper-spring-boot-starter</artifactId>
      <version>1.3.1</version>
</dependency>

This is a hidden pit. You need to know who introduced this plug-in.

[Solved] NPM i error: Legacy peer DEPs (Version Problem)

The problem is shown in the figure (the main reason for this problem is that the local NPM version is too high)

The solution is to downgrade NPM

npx -p npm@6 npm i --legacy-peer-deps

After running, a package-lock.json file will be generated. The main function of this file is to lock the version number of the installation package to ensure that other members of the project have consistent dependencies during NPM install
after the above steps, NPM I can be installed successfully

Error: Flask Address already in use [How to Solve]

In Python’s flask framework, address already in use

This error message indicates that you have a process bound to the default port (5000). If you have run the same module before, it is likely that the process is still bound to the port.

First, use the port window to find the process:

sudo lsof - i : 5000

If nothing unexpected happens, after executing the above command, the port will display the running port: the number of 5000 process

Kill the executing process:

kill process number

[Solved] svn:Error output could not be translated from the native locale to UTF-8

Error output could not be translated from the native locale to UTF-8

Using the HTTP + SVN scheme, if the hook contains Chinese, an error prompt “error output could not be translated from the native locale to UTF-8.” may appear

The reason for this error is that the HTTP service itself has an encoding setting. Therefore, if the HTTP encoding is not set properly, the Chinese returned by the hook will cause an encoding error. The specific solutions are as follows:

<IfModule mod_dav_fs.c>
# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/lockdb
SVNUseUTF8 On
</IfModule>

[Solved] Git fatal: unable to access ‘xxx.git/’: Failed to connect to github.com port 443 after ***ms: Timed out

Change agent

See the port of your agent software

such as

set up

git config --global http.proxy http://127.0.0.1:1087

that’s enough

If you want to cancel

Cancel global proxy:

git config --global --unset http.proxy
 
git config --global --unset https.proxy

Commonly used

Git config — global http.proxy # view git’s HTTP proxy configuration

Git config — global https.proxy # view git’s HTTPS proxy configuration

Git config — Global – L # view all git configurations

[Solved] Hadoop runs start-dfs.sh error: attempting to operate on HDFS as root

Error message:

Starting namenodes on [master]
ERROR: Attempting to operate on hdfs namenode as root
ERROR: but there is no HDFS_NAMENODE_USER defined. Aborting operation.

Starting datanodes
ERROR: Attempting to operate on hdfs datanode as root
ERROR: but there is no HDFS_DATANODE_USER defined. Aborting operation.

Starting secondary namenodes
ERROR: Attempting to operate on hdfs secondarynamenode as root
ERROR: but there is no HDFS_SECONDARYNAMENODE_USER defined. Aborting operation.

Starting journal nodes
ERROR: Attempting to operate on hdfs journalnode as root
ERROR: but there is no HDFS_JOURNALNODE_USER defined. Aborting operation.

Starting ZK Failover Controllers on NN hosts
ERROR: Attempting to operate on hdfs zkfc as root
ERROR: but there is no HDFS_ZKFC_USER defined. Aborting operation.

reason:

Start the service with the root account, but it is not predefined

Solution:

*This step needs to be performed on each machine, or it can be modified on one machine first, and then synchronized to other machines by SCP

1. Modify start-dfs.sh and stop-dfs.sh

cd /home/hadoop/sbin
vim start-dfs.sh
vim stop-dfs.sh

Add the following to the header:

HDFS_ZKFC_USER=root
HDFS_JOURNALNODE_USER=root
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
HDFS_DATANODE_USER=root
HDFS_DATANODE_SECURE_USER=root
#HADOOP_SECURE_DN_USER=root

2. Modify start-yarn.sh and stop-yarn.sh

cd /home/hadoop/sbin
vim start-yarn.sh
vim stop-yarn.sh

Add the following to the header:

#HADOOP_SECURE_DN_USER=root
HDFS_DATANODE_SECURE_USER=root
YARN_NODEMANAGER_USER=root
YARN_RESOURCEMANAGER_USER=root

3. Synchronize to other machines

cd /home/hadoop/sbin
scp * c2:/home/hadoop/sbin
scp * c3:/home/hadoop/sbin
scp * c4:/home/hadoop/sbin

[Solved] GitHub desktop push error: fatal: could not read Username for ‘https://github.com’: No such file or directory

GitHub desktop installation, login to GitHub, configure SSH, submit and push modified content, but the error is as follows:

fatal: could not read Username for 'https://github.com': No such file or directory

The reason may be the GIT bash version problem

Solution: in the project document, right-click git bash here and execute the instruction to push normally

git remote set-url origin [email protected]:SouthBegonia/UnityWorld.git

Note: [email protected]: southbegonia/unityworld.Git is the SSH address of your own project

Hangfire error: could not load file or assembly ‘dynamicproxygenassembly2, culture = neutral, publickeytoken = null’. The system could not find the specified file.

The question is as follows:

Method of recurringrob:

//The reason for the error: As you can see from the first way in the red box above, you can not specify the class to which the methodCall belongs, but the limitation of this case is that the methodCall method executed by the job belongs to the same class as the job. In this case, it does belong to the same class, but the error is still reported.
RecurringJob.AddOrUpdate(recurringJobId, () => PushJobContent(), cronData, TimeZoneInfo.Local);

It is also the full version of the old honest and practical version, indicating the class to which the execution method belongs. After modification:

RecurringJob.AddOrUpdate<MessagePushAppService>(recurringJobId, x => x.PushJobContent(), cronData, TimeZoneInfo.Local);

Normal operation.

Notes:

1. Hangfire local time: timezoneinfo.local

2. UTC time: timezoneinfo.utc

Associated reading > Hangfire scheduled task method is not defined