小编J D*_*Del的帖子

Cassandra - 无法达到一致性等级QUORUM

我目前正在运行一个节点.我正在尝试为Cassandra启用密码身份验证.

我正在关注本指南:http://cassandra.apache.org/doc/latest/operating/security.html#password-authentication

我会注意到我没有改变system_auth复制,因为它是一个单节点集群.

我编辑cassandra.yaml使用authenticator: PasswordAuthenticator.

然后我重新启动cassandra并尝试了命令cqlsh -u cassandra -p cassandra,但这给了我错误:

Connection error: ('Unable to connect to any servers',
{'127.0.0.1': AuthenticationFailed(u'Failed to authenticate to 127.0.0.1: 
code=0100 [Bad credentials] message="org.apache.cassandra.exceptions.
UnavailableException: Cannot achieve consistency level QUORUM"',)})
Run Code Online (Sandbox Code Playgroud)

我试过跑,nodetool repair但它说:Replication factor is 1. No repair is needed for keyspace 'system_auth'

我该如何解决这个问题?

cassandra

7
推荐指数
3
解决办法
9570
查看次数

在node.js中连接ENOENT /var/run/mysqld/mysqld.sock时出错

我正在 Windows 上运行 Scotch Box(一个流浪的 LAMP 堆栈)。

我通过 PHP 或 Navicat 正常连接 MySQL 没有问题。

但我尝试连接到它,Node.js但收到错误“ Error connecting to MySQL: Error: connect ECONNREFUSED 127.0.0.1:3306

根据我通过搜索所了解的情况,似乎我需要设置套接字路径

但是当我这样做时,我收到错误“ Error connecting to MySQL: Error: connect ENOENT /var/run/mysqld/mysqld.sock

我 100% 确定这是正确的套接字路径。我已经通过 SSH 连接到 vagrant 并验证了 mysqld.sock 确实存在并且在 /etc/mysql/my.cnf 中设置正确。跳过网络也已关闭。

我还尝试将绑定地址设置为0.0.0.0并完全注释掉绑定地址,重命名mysqld.sock并重新启动mysql服务器,以便它再次重新创建mysqld.sock。还尝试禁用我的防火墙(无论如何都允许node.js)并重新安装MySQL。

这些都不起作用,错误仍然相同:“ Error connecting to MySQL: Error: connect ENOENT /var/run/mysqld/mysqld.sock

这是我到目前为止的代码:

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : 'root',
  database : 'test', …
Run Code Online (Sandbox Code Playgroud)

mysql node.js

5
推荐指数
1
解决办法
1万
查看次数

Golang 从 NodeJS 解密 AES 256 CBC base64

这是我在 Node.js 中所拥有的:

var crypto = require('crypto')

function encryptstring(str) {
    var cipher = crypto.createCipheriv('aes-256-cbc', 'NFd6N3v1nbL47FK0xpZjxZ7NY4fYpNYd', 'TestingIV1234567'),
        encrypted = cipher.update(str, 'utf-8', 'base64');
    encrypted += cipher.final('base64');
    return encrypted;
}

console.log(encryptstring("Testing 111111111111111111111111111111111111111111"))
Run Code Online (Sandbox Code Playgroud)

那返回: w2f0vBP2hRfgVqssqOluk68Qxkc9LXFESc0ZGzPBq3p6f/x/LbwBbg1XOoRr7I/DAtESJGdweKG6nL9m8RfewA==

这是我在 Go 中所拥有的:

package main

import (
    "crypto/aes"
    "crypto/cipher"
    "encoding/base64"
    "fmt"
)

// decrypt from base64 to decrypted string
func decrypt(key []byte, iv []byte, cryptoText string) string {
    ciphertext, _ := base64.URLEncoding.DecodeString(cryptoText)
    block, err := aes.NewCipher(key)
    if err != nil {
        panic(err)
    }
    if len(ciphertext) < aes.BlockSize {
        panic("ciphertext …
Run Code Online (Sandbox Code Playgroud)

encryption go node.js

3
推荐指数
1
解决办法
2635
查看次数

标签 统计

node.js ×2

cassandra ×1

encryption ×1

go ×1

mysql ×1