Category Archives: Linux

Rabbitmq error of connecting the native idea to Linux: java.net.connectexception: connection timed out: Connect [Solved]

The code is as follows:

        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("192.168.2.135");
        connectionFactory.setPort(5672);
        connectionFactory.setUsername("admin");
        connectionFactory.setPassword("admin");
        connectionFactory.setVirtualHost("/");

        Connection connection=null;
        Channel channel = null;

        try {
            //2.create linke Connection
            connection = connectionFactory.newConnection("Creator");

Error: Java. Net. Connectexception: connection timed out: connect

Cause analysis: first, the IP port account and password are excluded

Error reason: port 5672 is not open. I always thought that everything would be fine as long as the protective wall was closed

Solution:

1. Restart the firewall: systemctl start firewall

2. Open 5672 port: firewall CMD — zone = public — add port = 5672/TCP — permanent

3. Reload: firewall CMD — reload

Run debug:

success!!!

Centos6.8 yum Error & Fix YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid

0. View Yum configuration

vim /etc/yum.repos.d/CentOS-Base.repo

Add a comment to the mirrorlist in the original configuration, and delete the comment from the baseurl – take the base as an example, and make the same changes to others

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Find the $releaser in the configuration file, so first check whether the $releaser can get the corresponding version

[root@hadoop1 yum.repos.d]# lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:    CentOS
Description:    CentOS release 6.8 (Final)
Release:    6.8
Codename:    Final

It is found that there is no problem in obtaining the version number

An error will still be reported at this time

https://vault.centos.org/6/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: extras. Please verify its path and try again

Baseurl link http://mirror.centos.org/centos/ There are no more resources

Reconfigure resource paths https://vault.centos.org/6.8/

Modified configuration

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/6.8/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://vault.centos.org/6.8/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://vault.centos.org/6.8/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://vault.centos.org/6.8/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=https://vault.centos.org/6.8/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Run again and Yum returns to normal

Linux error: command not found [How to Solve]

I saw a fun project some time ago: [musicbox]( https://github.com/darknessomi/musicbox )Start installing with git clone, and the input command cannot be run. At first, I thought there was a problem with the installation, so I changed to PIP installation. I found that it still couldn’t run
interface error: command not found

At first I wondered why I couldn’t find the order?After searching, it is found that the commands viewed by Linux must be placed in/usr/bin /. If they are not in this directory, they will not be found
at this time, we need to create a link file for these commands that cannot be found. Link it to/usr/bin to directly execute our commands

Establishing a soft link is equivalent to establishing a shortcut:

1、Want to see where the installation directory is
find/-name musicbox

2、Create a soft link
ln -s /usr/local/musicbox/bin/musicbox    /usr/bin

 

After doing the above operations, you can find the corresponding command

How to Solve Git commit error: error: insufficient permission for adding an object to repository database .git/objects

Problem:

git add or git commit error:

error: insufficient permission for adding an object to repository database .git/objects
error: insufficient permission for adding an object to repository database .git/objects
error: Error building trees

solution

sudo chown -R cygr-0101-01-0133 *

cd .git

sudo chown -R cygr-0101-01-0133 *

central reason

https://stackoverflow.com/questions/28832815/git-commands-require-sudo-on-osx

In fact, when our versiongit clonerequires systemssudopermissions, and our system is connected. It should be that ssh requires system privileges. Even if it works, then it also requires the git fetch and git push. But at least, saving is not bad…

Detected Detection

chown -R < If this option is checked, KDM will show a list of users, so users can click on their name or image rather than typing in their login. myproject

 

[Solved] Git review Error: Errors running git rebase -i remotes/gerrit/master

The following error was reported when the code was modified online and finally submitted for review using git review.
[wangshibo@115~]$ vim testfile           #Modify
[wangshibo@115~]$ git add testfile
[wangshibo@115~]$ git commit -m “123”
[wangshibo@115~ ]$ git review
Errors running git rebase -i remotes/gerrit/master
Interactive rebase already started
…..

Solution:
[wangshibo@115~]$ git review -v
2016-07-19 15:37:49.838087 Running: git log –color=never –oneline HEAD^1..HEAD
2016-07-19 15:37:49.841756 Running: git remote
2016-07-19 15:37:49.844743 Running: git branch -a –color=never
2016-07-19 15:37:49.847957 Running: git rev-parse –show-toplevel –git-dir
2016-07-19 15:37:49.850729 Running: git remote update gerrit
Fetching gerrit
2016-07-19 15:37:49.962033 Running: git rebase -i remotes/gerrit/master
Errors running git rebase -i remotes/gerrit/master
Interactive rebase already started

Use the “git rebase -i –abort” command to start over.

[wangshibo@115~]$ git rebase -i –abort
[wangshibo@115~]$ git review -v
2016-07-19 15:39:02.470947 Running: git log –color=never –oneline HEAD^1..HEAD
2016-07-19 15:39:02.474624 Running: git remote
2016-07-19 15:39:02.477638 Running: git branch -a –color=never
2016-07-19 15:39:02.480825 Running: git rev-parse –show-toplevel –git-dir
2016-07-19 15:39:02.483649 Running: git remote update gerrit
Fetching gerrit
2016-07-19 15:39:02.595045 Running: git rebase -i remotes/gerrit/master
Errors running git rebase -i remotes/gerrit/master
Automatic cherry-pick failed. After resolving the conflicts,
mark the corrected paths with ‘git add <paths>’, and
run ‘git rebase –continue’
Could not apply 0e37bdc… test

 

[wangshibo@115~]$ git add testfile
[wangshibo@115~]$ git rebase –continue                # Continue to change the base and return to the original HEAD
[detached HEAD d854154] test
1 files changed, 4 insertions(+), 0 deletions(-)
Successfully rebased and updated refs/heads/master.

[wangshibo@115~]$ git commit -m “123”
# On branch master
# Your branch is ahead of ‘origin/master’ by 1 commit.
#
nothing to commit (working directory clean)

Finally the git review works again
[wangshibo@115~]$ git review
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: new: 1, refs: 1, done
remote:
remote: New Changes:
remote: http://103.10.86.30:80/16 test
remote:
To ssh://[email protected]:29418/xqsj_android.git
* [new branch] HEAD -> refs/publish/master

How to Solve Linux Error: ifconfig command not found

1. An error is reported when inputting ifconfig command in Linux: ifconfig command not found

Ifconfig may not be installed. If not, install it

2. Check if ifconfig is missing. It is in/usr/SBIN directory

root@localhost ~]#Ll/usr/SBIN

check if there is ifconfig

if there is no ifconfig, install the net tools package

[ root@localhost sbin]# sudo yum install net-tools

 

Nginx error 111: connection rejected [How to Solve]

Recently, I encountered nginx crazy throwing errors. There are more than 5W entries in access.log a day, but there are about 9K entries in error.log, which are basically 111: connection rejected . Why

From the log

Let’s look at the log first. I extracted a log of errors thrown in the error.log (divide it into one line slightly, otherwise it is too long, and handle the sensitive information slightly):

2019/06/06 10:09:45 [error] 28652#0: *883239 connect() failed (111: Connection refused) while connecting to upstream, 
client: 124.104.90.145, server: xxx.xxxxx.com, request: "POST /test-service/upload?mcachenum=155978698 HTTP/1.1", 
upstream: "http://[::1]:17000/test-service/upload?mcachenum=155978698", host: "xxx.xxxxx.com", 
referrer: "https://servicewechat.com/x98b46f69/2/page-frame.html"

After looking at the error report in front and the description in the back, it seems normal at first glance. But after looking again, I found that the host in upstream is somewhat different [:: 1] , which is actually an IPv6 address

 

At this time, you can check whether your machine has IPv6 address enabled. The command of Linux is: IP address , and see if inet6 appears in the returned result. If so, congratulations. The reason has been found

Solution

There are two solutions. One is to disable the IPv6 configuration of your machine, and the other is to modify the configuration in nginx.conf

Personally, I think the latter method is safer because it does not involve your machine configuration and should be relatively least

The modification of nginx.conf is to modify proxy for location in the server module_The host in pass , which we often see on the Internet, is:

proxy_pass http://localhost:18000/test -service/;

However, in order to forcibly specify the IPv4 address, it needs to become:

proxy_pass http://127.0.0.1:18000/test -service/;

 

After this operation, observe the error.log of nginx, and there should be no more IPv6 address errors in upstream

Summary

The above is the whole process of my mistake. Although the whole process is not long, it does let me know that as a back-end development, my knowledge is still too narrow. And Bing is really easy to use. I can’t climb the wall recently. It’s good to use Bing instead for the time being

Umount error: /home: target is busy. [How to Solve]

 

Record an error when alicloud ECS is operated and the disk is unloaded. The result of alicloud data disk unloading shows:

umount: /home: target is busy.
(In some cases useful info about processes that use   the device is found by lsof(8) or fuser(1))

At first glance, it is very simple. If a process is occupying the disk, it is OK to exit. However, after troubleshooting, it is found that no process is occupied. At this time, a command needs to be used: fuser (use file or file structure to identify the process)

fuser -m -v /dev/vdb

-m   Name specifies a file mounted on the file system or a mounted block device (name). In this way, all processes accessing the file or file system will be listed. If a directory is specified, it will be automatically converted to “name /”, and all file systems mounted under that directory will be used;

-v   Detailed mode, output like PS command, including PID, user, command and many other fields. If it is accessed by the kernel, the PID is the kernel. – V output version number;

 

-k   Kill the process that accesses the file. If – signal is not specified, sigkill signal will be sent;

-a   Displays all the files specified on the command line. By default, the accessed files will be displayed.