??xml version="1.0" encoding="utf-8" standalone="yes"?>棒球比分app:BlogJava - 棒球比分大小怎么算|վ//www.355548.live/paulwong/zh-cnMon, 06 Apr 2020 04:42:44 GMTMon, 06 Apr 2020 04:42:44 GMT60List sessions / active connections on MariaDB server - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/04/02/435313.htmlpaulwongpaulwongThu, 02 Apr 2020 07:38:00 GMT//www.355548.live/paulwong/archive/2020/04/02/435313.html//www.355548.live/paulwong/comments/435313.html//www.355548.live/paulwong/archive/2020/04/02/435313.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435313.html//www.355548.live/paulwong/services/trackbacks/435313.htmlUsing a command

Option 1

show status where variable_name = 'threads_connected'; 

Columns

  • Variable_name - Name of the variable shown
  • Value - Number of active connections

Rows

  • One row: Only one row is displayed

Sample results

Option 2

show processlist; 

Columns

  • Id - The connection identifier
  • User - The MariaDB user who issued the statement
  • Host - Host name and client port of the client issuing the statement
  • db - The default database (schema), if one is selected, otherwise NULL
  • Command - The type of command the thread is executing
  • Time - The time in seconds that the thread has been in its current state
  • State - An action, event, or state that indicates what the thread is doing
  • Info - The statement the thread is executing, or NULL if it is not executing any statement
  • Progress - The total progress of the process (0-100%)

Rows

  • One row: represents one active connection
  • Scope of rows: total of active connections

Sample results

Using a query

Option 3

select id, user, host, db, command, time, state, 
info, progress from information_schema.processlist;

Columns

  • Id - The connection identifier
  • User - The MariaDB user who issued the statement
  • Host - Host name and client port of the client issuing the statement
  • db - The default database (schema), if one is selected, otherwise NULL
  • Command - The type of command the thread is executing
  • Time - The time in seconds that the thread has been in its current state
  • State - An action, event, or state that indicates what the thread is doing
  • Info - The statement the thread is executing, or NULL if it is not executing any statement
  • Progress - The total progress of the process (0-100%)
  • memory_used - Amount of memory used by the active connection

Rows

  • One row: represents one active connection
  • Scope of rows: total of active connections

Sample results

Using the GUI

Option 4

Click on the Client Connections option of the Management tab (left navigation pane)

This action will show the Client Connections screen containing the current active connections



paulwong 2020-04-02 15:38 发表评论
]]>
Finding slow queries in MongoDB - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/27/435309.htmlpaulwongpaulwongFri, 27 Mar 2020 15:35:00 GMT//www.355548.live/paulwong/archive/2020/03/27/435309.html//www.355548.live/paulwong/comments/435309.html//www.355548.live/paulwong/archive/2020/03/27/435309.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435309.html//www.355548.live/paulwong/services/trackbacks/435309.htmlDatabase Profiling

MongoDB Profiler is a db profiling system that can help identify inefficient

or slow queries and operations.

Levels of profiles available are:

Level

Setting

0

Off. & No profiling

1

On & only includes slow operations

2

On & Includes all operations


We can enable it by setting the Profile level value using the following
command in mongo shell :

"db.setProfilingLevel(1)"

By default, mongod records slow queries to its log, as defined by slowOpThresholdMs.

NOTE

Enabling database profiler puts negative impact on MongoDB’s performance.

It’s better to enable it for specific intervals & minimal on Production Servers.

We can enable profiling on a mongod basis but This setting will not propagate
across a replica set and sharded cluster.

We can view the output in the system.profile collection in mongo shell using show profile command, or using following:

db.system.profile.find( { millis : { $gt : 200 } } )

Command returns operations that took longer than 200 ms. Similarly we
can change the values as per our need.

Enabling profile for an entire mongod instance.

For the purpose of development in testing, we can enable database profiling/settings for an 
entire mongod instance. The profiling level will be applied to all databases.

 

NOTE:

We can't enable the profiling settings on a mongos instance. To enable the profiling in

shard clusters, we have to enable/start profiling for each mongod instance in cluster.

 

Query for the recent 10 entries

db.system.profile.find().limit(10).sort( { ts : 1 } ).pretty()

 

Collection with the slowest queries(No. Of queries)

db.system.profile.group({key: {ns: true}, initial: {count: 0}, reduce: function(obj,prev){ prev.count++;}})

 

Collection with the slowest queries(No. Of millis spent)

db.system.profile.group({key: {ns: true}, initial: {millis: 0}, reduce: function(obj, prev){ prev.millis += obj.millis;}})

 

Most recent slow query

db.system.profile.find().sort({$natural: -1}).limit(1)

 

Single slowest query(Right now)

db.system.profile.find().sort({millis: -1}).limit(1)



paulwong 2020-03-27 23:35 发表评论
]]>
ZLINUX的分布式文gpȝGlusterFS + NFS-Ganesha - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/22/435293.htmlpaulwongpaulwongSun, 22 Mar 2020 03:46:00 GMT//www.355548.live/paulwong/archive/2020/03/22/435293.html//www.355548.live/paulwong/comments/435293.html//www.355548.live/paulwong/archive/2020/03/22/435293.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435293.html//www.355548.live/paulwong/services/trackbacks/435293.html
GlusterFS是分布文件存储系l, 也即一个文件有三个备䆾Q每个备份可以放C同的节点(IP)上,q样某个节点CRASH后,会从其他节点取文件?br />
NFS-Ganesha则是用户层面非KERNAL层面的实CNFS SERVER的功能,但双加了扩展Q对外提供基于NFS协议的文件存取服务?br />
资源Q?br />GlusterFS and NFS-Ganesha integration
https://staged-gluster-docs.readthedocs.io/en/release3.7.0beta1/Features/glusterfs_nfs-ganesha_integration/

Exporting and Unexporting Volumes through nfs-ganesha
https://access.redhat.com/documentation/en-US/Red_Hat_Storage/2.1/html/Administration_Guide/Starting_and_Stopping_nfs-ganesha.html

https://www.snia.org/sites/default/files/Poornima_NFS_GaneshaForClusteredNAS.pdf







paulwong 2020-03-22 11:46 发表评论
]]>
开机nfs自动挂蝲 - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/21/435290.htmlpaulwongpaulwongSat, 21 Mar 2020 11:44:00 GMT//www.355548.live/paulwong/archive/2020/03/21/435290.html//www.355548.live/paulwong/comments/435290.html//www.355548.live/paulwong/archive/2020/03/21/435290.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435290.html//www.355548.live/paulwong/services/trackbacks/435290.htmlQ.echo "mount -t nfs -o nolock ${IP}:${remote_dir} ${local_dir}" >>  /etc/rc.local

Q.echo "${IP}:/home/logs /home/logs nfs defaults 0 0" >> /etc/fstab

棒球比分app:关于/etc/rc.local


rc.local也是我经怋用的一个脚本。该脚本是在pȝ初始化别脚本运行之后再执行的,因此可以安全地在里面d你想在系l启动之后执行的脚本。常见的情况是你可以再里面添加nfs挂蝲/mount脚本。此外,你也可以在里面添加一些调试用的脚本命令。例如,我就到q这U情况:samba服务L无法正常q行Q而检查发玎ͼsamba是在pȝ启动q程中就该启动执行的Q也是_samba守护E序配置保证了这U功能本应该正确执行。碰到这U类似情况,一般我也懒得花大量旉LZ么,我只需要简单的?etc/rc.local脚本里加上这么一行:

/etc/init.d/samba start

q样成功的解决了samba服务异常的问题?img src ="//www.355548.live/paulwong/aggbug/435290.html" width = "1" height = "1" />

paulwong 2020-03-21 19:44 发表评论
]]>
利用 Chef ?Red Hat Enterprise Linux 上自动化部v Mariadb Galera Cluster - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/21/435289.htmlpaulwongpaulwongSat, 21 Mar 2020 02:55:00 GMT//www.355548.live/paulwong/archive/2020/03/21/435289.html//www.355548.live/paulwong/comments/435289.html//www.355548.live/paulwong/archive/2020/03/21/435289.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435289.html//www.355548.live/paulwong/services/trackbacks/435289.htmlhttps://www.ibm.com/developerworks/cn/linux/1611_chensz_mgc/index.html



paulwong 2020-03-21 10:55 发表评论
]]>
在SPRING BOOT中用多JMS CONNECTION - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/19/435278.htmlpaulwongpaulwongThu, 19 Mar 2020 01:45:00 GMT//www.355548.live/paulwong/archive/2020/03/19/435278.html//www.355548.live/paulwong/comments/435278.html//www.355548.live/paulwong/archive/2020/03/19/435278.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435278.html//www.355548.live/paulwong/services/trackbacks/435278.html
ActiveMQConnectionFactoryFactory.java
import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.List;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQConnectionFactoryCustomizer;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQProperties;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQProperties.Packages;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;


/**
 * Factory to create a {
@link ActiveMQConnectionFactory} instance from properties defined
 * in {
@link SecondaryActiveMQProperties}.
 *
 * 
@author Phillip Webb
 * 
@author Venil Noronha
 
*/
class ActiveMQConnectionFactoryFactory {

    private static final String DEFAULT_EMBEDDED_BROKER_URL = "vm://localhost?broker.persistent=false";

    private static final String DEFAULT_NETWORK_BROKER_URL = "tcp://localhost:61616";

    private final ActiveMQProperties properties;

    private final List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers;

    ActiveMQConnectionFactoryFactory(ActiveMQProperties properties,
            List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
        Assert.notNull(properties, "Properties must not be null");
        this.properties = properties;
        this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers : Collections.emptyList();
    }

    public <T extends ActiveMQConnectionFactory> T createConnectionFactory(Class<T> factoryClass) {
        try {
            return doCreateConnectionFactory(factoryClass);
        }
        catch (Exception ex) {
            throw new IllegalStateException("Unable to create " + "ActiveMQConnectionFactory", ex);
        }
    }

    private <T extends ActiveMQConnectionFactory> T doCreateConnectionFactory(Class<T> factoryClass) throws Exception {
        T factory = createConnectionFactoryInstance(factoryClass);
        if (this.properties.getCloseTimeout() != null) {
            factory.setCloseTimeout((intthis.properties.getCloseTimeout().toMillis());
        }
        factory.setNonBlockingRedelivery(this.properties.isNonBlockingRedelivery());
        if (this.properties.getSendTimeout() != null) {
            factory.setSendTimeout((intthis.properties.getSendTimeout().toMillis());
        }
        Packages packages = this.properties.getPackages();
        if (packages.getTrustAll() != null) {
            factory.setTrustAllPackages(packages.getTrustAll());
        }
        if (!packages.getTrusted().isEmpty()) {
            factory.setTrustedPackages(packages.getTrusted());
        }
        customize(factory);
        return factory;
    }

    private <T extends ActiveMQConnectionFactory> T createConnectionFactoryInstance(Class<T> factoryClass)
            throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
        String brokerUrl = determineBrokerUrl();
        String user = this.properties.getUser();
        String password = this.properties.getPassword();
        if (StringUtils.hasLength(user) && StringUtils.hasLength(password)) {
            return factoryClass.getConstructor(String.class, String.class, String.class).newInstance(user, password,
                    brokerUrl);
        }
        return factoryClass.getConstructor(String.class).newInstance(brokerUrl);
    }

    private void customize(ActiveMQConnectionFactory connectionFactory) {
        for (ActiveMQConnectionFactoryCustomizer factoryCustomizer : this.factoryCustomizers) {
            factoryCustomizer.customize(connectionFactory);
        }
    }

    String determineBrokerUrl() {
        if (this.properties.getBrokerUrl() != null) {
            return this.properties.getBrokerUrl();
        }
        if (this.properties.isInMemory()) {
            return DEFAULT_EMBEDDED_BROKER_URL;
        }
        return DEFAULT_NETWORK_BROKER_URL;
    }
}

TwinJmsConnectionFactoryConfiguration.java
import java.util.stream.Collectors;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.messaginghub.pooled.jms.JmsPoolConnectionFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.jms.JmsPoolConnectionFactoryFactory;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQConnectionFactoryCustomizer;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;


@Configuration
@Profile({"local"})
public class TwinJmsConnectionFactoryConfiguration {

    @Bean
    @ConfigurationProperties(prefix = "spring.activemq.primary")
    public ActiveMQProperties primaryActiveMQProperties() {
        return new ActiveMQProperties();
    }
    
    @Bean(destroyMethod = "stop")
    @Primary
    @ConditionalOnProperty(prefix = "spring.activemq.pool", name = "enabled", havingValue = "true")
    public JmsPoolConnectionFactory connectionFactory(ActiveMQProperties primaryActiveMQProperties,
            ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactoryFactory(primaryActiveMQProperties,
                factoryCustomizers.orderedStream().collect(Collectors.toList()))
                .createConnectionFactory(ActiveMQConnectionFactory.class);
        return new JmsPoolConnectionFactoryFactory(primaryActiveMQProperties.getPool())
                .createPooledConnectionFactory(connectionFactory);
    }
    
    ////////////////////////////////////////////////////////////////////////////////
    @Bean
    @ConfigurationProperties(prefix = "spring.activemq.sescond")
    public ActiveMQProperties sescondActiveMQProperties() {
        return new ActiveMQProperties();
    }
    
    @Bean(destroyMethod = "stop")
    @ConditionalOnProperty(prefix = "spring.activemq.pool", name = "enabled", havingValue = "true")
    public JmsPoolConnectionFactory sescondPooledJmsConnectionFactory(ActiveMQProperties sescondActiveMQProperties,
            ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
        ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactoryFactory(sescondActiveMQProperties,
                factoryCustomizers.orderedStream().collect(Collectors.toList()))
                .createConnectionFactory(ActiveMQConnectionFactory.class);
        return new JmsPoolConnectionFactoryFactory(sescondActiveMQProperties.getPool())
                .createPooledConnectionFactory(connectionFactory);
    }
    
}




paulwong 2020-03-19 09:45 发表评论
]]>
Which is better: PooledConnectionFactory or CachingConnectionFactory? - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/19/435277.htmlpaulwongpaulwongThu, 19 Mar 2020 01:37:00 GMT//www.355548.live/paulwong/archive/2020/03/19/435277.html//www.355548.live/paulwong/comments/435277.html//www.355548.live/paulwong/archive/2020/03/19/435277.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435277.html//www.355548.live/paulwong/services/trackbacks/435277.htmlFrom here:

The difference between the PooledConnectionFactory and the CachingConnectionFactory is a difference in implementation. Below are some of the characteristics that differ between them:

  • Although both the PooledConnectionFactory and the CachingConnectionFactory state that they each pool connections, sessions and producers, the PooledConnectionFactory does not actually create a cache of multiple producers. It simply uses a singleton pattern to hand out a single cached producer when one is requested. Whereas the CachingConnectionFactory actually creates a cache containing multiple producers and hands out one producer from the cache when one is requested.

  • The PooledConnectionFactory is built on top of the Apache Commons Pool project for pooling JMS sessions. This allows some additional control over the pool because there are features in Commons Pool that are not being used by the PooledConnectionFactory. These additional features include growing the pool size instead of blocking, throwing an exception when the pool is exhausted, etc. You can utilize these features by creating your own Commons Pool GenericObjectPool using your own customized settings and then handing that object to the PooledConnectionFactory via the setPoolFactory method. See the following for additional info: //commons.apache.org/pool/api-1.4/org/apache/commons/pool/impl/GenericObjectPoolFactory.html

  • The CachingConnectionFactory has the ability to also cache consumers. Just need to take care when using this feature so that you know the consumers are cached according to the rules noted in the blog post.

  • But most importantly, the CachingConnectionFactory will work with any JMS compliant MOM. It only requires a JMS connection factory. This is important if you are using more than one MOM vendor which is very common in enterprise organizations (this is mainly due to legacy and existing projects). The important point is that the CachingConnectionFactory works very well with many different MOM implementations, not only ActiveMQ.

From here:

  • If you have clustered ActiveMQs, and use failover transport it has been reported that CachingConnectionFactory is not a right choice.

  • The problem I’m having is that if one box goes down, we should start sending messages on the other, but it seems to still be using the old connection (every send times out). If I restart the program, it’ll connect again and everything works. Source: Autoreconnect problem with ActiveMQ and CachingConnectionFactory

  • The problem is that cached connections to the failed ActiveMQ was still in use and that created the problem for the user. Now, the choice for this scenario is PooledConnectionFactory.

  • If you’re using ActiveMQ today, and chances are that you may switch to some other broker (JBoss MQ, WebSphere MQ) in future, do not use PooledConnectionFactory, as it tightly couples your code to ActiveMQ.



paulwong 2020-03-19 09:37 发表评论
]]>
Spring Boot Data Mongodb Starter自动配置那些?/title><link>//www.355548.live/paulwong/archive/2020/03/17/435271.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Tue, 17 Mar 2020 01:39:00 GMT</pubDate><guid>//www.355548.live/paulwong/archive/2020/03/17/435271.html</guid><wfw:comment>//www.355548.live/paulwong/comments/435271.html</wfw:comment><comments>//www.355548.live/paulwong/archive/2020/03/17/435271.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.355548.live/paulwong/comments/commentRss/435271.html</wfw:commentRss><trackback:ping>//www.355548.live/paulwong/services/trackbacks/435271.html</trackback:ping><description><![CDATA[<div style="font-size: medium;"><div class="dntg"><p>正好做MongodbM复制试使用Spring Boot Data Mongodb Starter插g链接讉KMongodb数据库集?/p><p>遇到的坑Q?/p><ul class="dntg"><li class="dntg">spring.data.mongodb.host和spring.data.mongodb.port形式不适合集群配置Q会报host无法识别异常</li><li class="dntg">spring.data.mongodb.uri中经常抛出authentication failed异常</li></ul><p><br /></p><p>解决办法Q?/p><ol><li class="dntg"> 对于W一个坑Q请使用spring.data.mongodb.uri?span style="background-color: yellow;">如果使用了uriQ则其余的host/username/password/db/auth-dbq些全部无效?/span></li><li class="dntg"> 对于W二个坑Q请在spring.data.mongodb.uri中指定replicaSet和authsourceQ另外记得把所有集节Ҏ务器地址都列全?br /><span style="background-color: yellow;">如果auth-db和db是同一个,则无需加authsourceQ如果不同,则加authsource=admin</span></li></ol><p><br /></p><p>我没有把authsource指定Q所以一直报authentication failed异常。然后只好一点点d掘问题点Q最后查到在com.mongodb.ConnectionStringcM的createCredentials?br /><br /></p><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">private</span> MongoCredential createCredentials(<span style="color: #0000FF; ">final</span> Map<String, List<String>> optionsMap, <span style="color: #0000FF; ">final</span> String userName,<br />                                              <span style="color: #0000FF; ">final</span> <span style="color: #0000FF; ">char</span>[] password) {<br />        AuthenticationMechanism mechanism = <span style="color: #0000FF; ">null</span>;<br />        String authSource = (database == <span style="color: #0000FF; ">null</span>) ? "admin" : database;<br />        String gssapiServiceName = <span style="color: #0000FF; ">null</span>;<br />        String authMechanismProperties = <span style="color: #0000FF; ">null</span>;<br /><br />        <span style="color: #0000FF; ">for</span> (<span style="color: #0000FF; ">final</span> String key : AUTH_KEYS) {<br />            String value = getLastValue(optionsMap, key);<br /><br />            <span style="color: #0000FF; ">if</span> (value == <span style="color: #0000FF; ">null</span>) {<br />                <span style="color: #0000FF; ">continue</span>;<br />            }<br /><br />            <span style="color: #0000FF; ">if</span> (key.equals("authmechanism")) {<br />                mechanism = AuthenticationMechanism.fromMechanismName(value);<br />            } <span style="color: #0000FF; ">else</span> <span style="color: #0000FF; ">if</span> (key.equals("authsource")) {<br />                authSource = value;<br />            } <span style="color: #0000FF; ">else</span> <span style="color: #0000FF; ">if</span> (key.equals("gssapiservicename")) {<br />                gssapiServiceName = value;<br />            } <span style="color: #0000FF; ">else</span> <span style="color: #0000FF; ">if</span> (key.equals("authmechanismproperties")) {<br />                authMechanismProperties = value;<br />            }<br />        }<br /><br /><br />        MongoCredential credential = <span style="color: #0000FF; ">null</span>;<br />        <span style="color: #0000FF; ">if</span> (mechanism != <span style="color: #0000FF; ">null</span>) {<br />            <span style="color: #0000FF; ">switch</span> (mechanism) {<br />                <span style="color: #0000FF; ">case</span> GSSAPI:<br />                    credential = MongoCredential.createGSSAPICredential(userName);<br />                    <span style="color: #0000FF; ">if</span> (gssapiServiceName != <span style="color: #0000FF; ">null</span>) {<br />                        credential = credential.withMechanismProperty("SERVICE_NAME", gssapiServiceName);<br />                    }<br />                    <span style="color: #0000FF; ">break</span>;<br />                <span style="color: #0000FF; ">case</span> PLAIN:<br />                    credential = MongoCredential.createPlainCredential(userName, authSource, password);<br />                    <span style="color: #0000FF; ">break</span>;<br />                <span style="color: #0000FF; ">case</span> MONGODB_CR:<br />                    credential = MongoCredential.createMongoCRCredential(userName, authSource, password);<br />                    <span style="color: #0000FF; ">break</span>;<br />                <span style="color: #0000FF; ">case</span> MONGODB_X509:<br />                    credential = MongoCredential.createMongoX509Credential(userName);<br />                    <span style="color: #0000FF; ">break</span>;<br />                <span style="color: #0000FF; ">case</span> SCRAM_SHA_1:<br />                    credential = MongoCredential.createScramSha1Credential(userName, authSource, password);<br />                    <span style="color: #0000FF; ">break</span>;<br />                <span style="color: #0000FF; ">default</span>:<br />                    <span style="color: #0000FF; ">throw</span> <span style="color: #0000FF; ">new</span> UnsupportedOperationException(format("The connection string contains an invalid authentication mechanism'. "<br />                                                                           + "'%s' is not a supported authentication mechanism",<br />                            mechanism));<br />            }<br />        } <span style="color: #0000FF; ">else</span> <span style="color: #0000FF; ">if</span> (userName != <span style="color: #0000FF; ">null</span>) {<br />            credential = MongoCredential.createCredential(userName, authSource, password);<br />        }<br /><br />        <span style="color: #0000FF; ">if</span> (credential != <span style="color: #0000FF; ">null</span> && authMechanismProperties != <span style="color: #0000FF; ">null</span>) {<br />            <span style="color: #0000FF; ">for</span> (String part : authMechanismProperties.split(",")) {<br />                String[] mechanismPropertyKeyValue = part.split(":");<br />                <span style="color: #0000FF; ">if</span> (mechanismPropertyKeyValue.length != 2) {<br />                    <span style="color: #0000FF; ">throw</span> <span style="color: #0000FF; ">new</span> IllegalArgumentException(format("The connection string contains invalid authentication properties. "<br />                            + "'%s' is not a key value pair", part));<br />                }<br />                String key = mechanismPropertyKeyValue[0].trim().toLowerCase();<br />                String value = mechanismPropertyKeyValue[1].trim();<br />                <span style="color: #0000FF; ">if</span> (key.equals("canonicalize_host_name")) {<br />                    credential = credential.withMechanismProperty(key, Boolean.valueOf(value));<br />                } <span style="color: #0000FF; ">else</span> {<br />                    credential = credential.withMechanismProperty(key, value);<br />                }<br />            }<br />        }<br />        <span style="color: #0000FF; ">return</span> credential;<br />    }</div><p><br /></p><p>authSource默认会指向我们目标数据的数据库。然而在w䆾验证机制中我们通常需要指向admin。(非常x_口Q代码作者在q里脑袋被men挤了么)。所以需要强制指定authSource中指定。具体指定方式如下:</p><p> </p><p> </p><p> </p><p> </p><pre bash"=""><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />-->mongodb://{用户名}:{密码}@{host1}:27017,{host2}:27017,{host3}:27017/{目标数据库}?replicaSet={复制集名U}&write=1&readPreference=primary&authsource={授权数据库}</div></pre></div></div><img src ="//www.355548.live/paulwong/aggbug/435271.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.355548.live/paulwong/" target="_blank">paulwong</a> 2020-03-17 09:39 <a href="//www.355548.live/paulwong/archive/2020/03/17/435271.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SPRING BATCH中STEP如果没加TRANSACTION MANAGER - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/16/435267.htmlpaulwongpaulwongMon, 16 Mar 2020 01:43:00 GMT//www.355548.live/paulwong/archive/2020/03/16/435267.html//www.355548.live/paulwong/comments/435267.html//www.355548.live/paulwong/archive/2020/03/16/435267.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435267.html//www.355548.live/paulwong/services/trackbacks/435267.html
+------------+--------------+-------------+-----------------+------------------+--------------------+----------------+-----------+-------------------------
 | READ_COUNT | FILTER_COUNT | WRITE_COUNT | READ_SKIP_COUNT | WRITE_SKIP_COUNT | PROCESS_SKIP_COUNT | ROLLBACK_COUNT | EXIT_CODE | EXIT_MESSAGE
-+------------+--------------+-------------+-----------------+------------------+--------------------+----------------+-----------+-------------------------
 |          1 |            0 |           1 |               0 |                0 |                  0 |              0 | COMPLETED |
 |      30006 |            0 |       29947 |               0 |               59 |                  0 |             61 | COMPLETED | Waited for 101 results.

如上面的L?0006Q但COMMIT的L?9947Q有59个被跌了?br />
因此需在STEP上加TRANSACTION MANAGER.

https://stackoverflow.com/questions/42803941/spring-batch-incorrect-write-skip-count-issue



paulwong 2020-03-16 09:43 发表评论
]]>
mySQL Error 1040: Too Many Connection - 棒球比分大小怎么算|վ//www.355548.live/paulwong/archive/2020/03/10/435247.htmlpaulwongpaulwongTue, 10 Mar 2020 12:20:00 GMT//www.355548.live/paulwong/archive/2020/03/10/435247.html//www.355548.live/paulwong/comments/435247.html//www.355548.live/paulwong/archive/2020/03/10/435247.html#Feedback0//www.355548.live/paulwong/comments/commentRss/435247.html//www.355548.live/paulwong/services/trackbacks/435247.html

To see how many connections are configured for your DB to use:

select @@max_connections;

To change it:

set global max_connections = 200;

To see how many are connected at the current time:

show processlist;
vi /etc/my.cnf

[mysqld]
max_connections = 500


]]>
{ganrao}