我按照couchbase教程连接到远程couchbase服务器,但在尝试打开默认存储桶后连接超时失败.
我已经检查过我可以在我的电脑上打开couchbase服务器页面(192.xx.xx.xx:8091)
这是我的Java代码
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.queryEnabled(true)
.build();
Cluster cluster = CouchbaseCluster.create(env,"192.xx.xx.xx:8091");
Bucket bucket = cluster.openBucket("default","");
JsonObject user = JsonObject.empty()
.put("firstname", "Walter")
.put("lastname", "White")
.put("job", "chemistry teacher")
.put("age", 50);
JsonDocument doc = JsonDocument.create("walter", user);
JsonDocument response = bucket.upsert(doc);
JsonDocument walter = bucket.get("walter");
System.out.println("Found: " + walter);
cluster.disconnect();
Run Code Online (Sandbox Code Playgroud)
和控制台
com.couchbase.client.core.CouchbaseCore <init>
CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslKeystorePassword='null', queryEnabled=true, queryPort=8093, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=4, computationPoolSize=4, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.1.4 (git: 2.1.4), dcpEnabled=false, retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy …Run Code Online (Sandbox Code Playgroud) 我的操作系统是 CentOS 6.6,我想知道如何通过 shell 脚本自动安装 mysql-server。
我发现有一个主题讨论了同样的问题,但它在 CentOS 6 上失败:在 ubuntu 上安装 mysql,没有密码提示
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password your_password'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password your_password'
Run Code Online (Sandbox Code Playgroud)
错误信息是
bash: debconf-set-selections: command not found
Run Code Online (Sandbox Code Playgroud)
这是我的基本脚本
#!/bin/sh
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
#password setting
root_password='abc123'
#install mysql-server
yum install mysql mysql-server
#start service
service mysqld start
#MySQL Initial …Run Code Online (Sandbox Code Playgroud)