Tag Archives: fail

After introducing security, the service cannot be registered with Eureka

When building the Eureka service of springcloud, security was introduced for security. However, it was found that the Eureka client could not register. The error log is as follows:

DiscoveryClient_ EUREKA-CLIENT/10.168.211.109:8001 – was unable to send heartbeat!

Later, I inquired about the Security version of the project (spring boot starter security in version 2.3.2.release introduces the security configuration of 5.3. X). If the version is too high, it will be changed by default   When CSRF (Cross Site Request Forgery) is turned on, you need to turn it off. The steps are as follows:

Add the following code into the startup file:


    @EnableWebSecurity
    static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.csrf().disable(); // Close csrf
            super.configure(http);
        }
    }

The test is effective.

MongoDB Error: Failed to start mongod.service: Unit mongodb.service is masked

Reference:

reference: http://club.verimake.com/topics/36 http://stackoverflow.com/questions/37014186/running-mongodb-on-ubuntu-16-04-lts

on MongoDB: Failed to start mongod. Service: Unit MongoDB. Service is masked, you can follow the following steps:
opens the following file:

sudo vim /etc/systemd/system/mongodb.service

Paste the following into the file and save

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

execute the following command:

sudo systemctl enable mongod.service
sudo systemctl daemon-reload
sudo service mongod start