alias 创建别名 aliases 列出可用的别名 authenticate 认证客户端 delete 删除实例 exec 在实例上运行命令 find 显示可用于创建实例的图像 get 获取配置设置 help 显示关于命令的帮助 info 显示有关实例的信息 launch 创建并启动一个Ubuntu实例 list 列出所有可用的实例 mount 在实例中挂载本地目录 networks 网络列出可用的网络接口 purge 永久清除所有已删除的实例 recover 恢复删除的实例 restart 重启实例 set 设置配置设置
multipass set local.polaris02.disk=20g
multipass set local.polaris02.memory=8g
multipass set local.polaris02.cpus=4
multipass set local.driver=virtualbox
multipass set client.primary-name=
shell 打开正在运行的实例上的shell start 启动实例 stop 停止运行实例 suspend 挂起正在运行的实例 transfer 在主机和实例之间传输文件 umount 从实例中解除挂载目录 unalias 删除别名 version 显示版本详细信息
这些属性可以以< key>=,…的格式指定。但是只有< name >的一个更简单的表单可用于最常见的用例。这里有一个例子:
$ multipass launch --network en0 --network name=bridge0,mode=manual
Launched: upbeat-whipsnake
$ multipass exec upbeat-whipsnake -- ip -br address show scope global
enp0s3 UP 10.0.2.15/24
enp0s8 UP 192.168.1.146/24
enp0s9 DOWN
$ ping -c1 192.168.1.146 # elsewhere in the same network
PING 192.168.1.146 (192.168.1.146): 56 data bytes
64 bytes from 192.168.1.146: icmp_seq=0 ttl=64 time=0.378 ms
[...]
$ multipass exec upbeat-whipsnake -- ip route
default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100
default via 192.168.1.1 dev enp0s8 proto dhcp src 192.168.1.146 metric 200
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15
10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100
192.168.1.0/24 dev enp0s8 proto kernel scope link src 192.168.1.146
192.168.1.1 dev enp0s8 proto dhcp scope link src 192.168.1.146 metric 200
$ multipass exec upbeat-whipsnake -- ip route get 91.189.88.181
91.189.88.181 via 10.0.2.2 dev enp0s3 src 10.0.2.15 uid 1000
cache
$ multipass exec upbeat-whipsnake -- ip route get 192.168.1.13
192.168.1.13 dev enp0s8 src 192.168.1.146 uid 1000
cache
桥接
在Linux上,当尝试将实例网络连接到主机上的以太网设备时,Multipass将提供创建所需的桥:
$ multipass networks
Name Type Description
eth0 ethernet Ethernet device
lxdbr0 bridge Network bridge
mpbr0 bridge Network bridge for Multipass
virbr0 bridge Network bridge
$ multipass launch --network eth0
Multipass needs to create a bridge to connect to eth0.
This will temporarily disrupt connectivity on that interface.
Do you want to continue (yes/no)?
$ sudo netplan try
Do you want to keep these settings?
Press ENTER before the timeout to accept the new configuration
Changes will revert in 120 seconds
...
# Assign the primary status to an instance called 'first':
$ multipass set client.primary-name=first
# Now this instance is picked up automatically by 'multipass start'
# The primary instance also automatically mounts the user's home directory into a directory called 'Home'
$ multipass start
Launched: first
Mounted '/home/ubuntu' into 'first:Home'
# Stop the primary instance
$ multipass stop
$ multipass launch --name second
Launched: second
# Change the primary instance to an existing instance
$ multipass set client.primary-name=second
# Now this instance is used by default by the commands
$ multipass suspend
# When listing all instances, the primary one is displayed first
$ multipass list
Name State IPv4 Image
second Suspended -- Ubuntu 18.04 LTS
first Stopped -- Ubuntu 18.04 LTS
$ multipass shell loving-duck
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-109-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Tue May 31 14:26:40 -03 2022
System load: 0.0 Processes: 113
Usage of /: 28.8% of 4.67GB Users logged in: 0
Memory usage: 21% IPv4 address for ens3: 10.49.93.241
Swap usage: 0%
1 update can be applied immediately.
To see these additional updates run: apt list --upgradable
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.
ubuntu@loving-duck:~$
$ multipass alias crazy-cat:ls lscc
You'll need to add this to your shell configuration (.bashrc, .zshrc or so) for
aliases to work without prefixing with `multipass`:
PATH="$PATH:/home/user/snap/multipass/common/bin"
$ multipass list
list failed: The client is not authenticated with the Multipass service.
Please use 'multipass authenticate' before proceeding.
$ multipass authenticate
Please enter passphrase:
authenticate failed: Passphrase is not set. Please `multipass set local.passphrase` with a trusted client.
$ multipass set local.passphrase
Please enter passphrase:
Please re-enter passphrase:
set failed: The client is not authenticated with the Multipass service.
Please use 'multipass authenticate' before proceeding.
然后似乎不可能授权客户端连接到服务。使用sudo时,这甚至可能不起作用。
以下解决方法应该有助于摆脱这种情况:
$ cat ~/snap/multipass/current/data/multipass-client-certificate/multipass_cert.pem | sudo tee -a /var/snap/multipass/common/data/multipassd/authenticated-certs/multipass_client_certs.pem > /dev/null
$ snap restart multipass
$ multipass authenticate --help
Usage: multipass authenticate [options] []
Authenticate with the Multipass service.
A system administrator should provide you with a passphrase
to allow use of the Multipass service.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
Arguments:
passphrase Passphrase to register with the Multipass service. If omitted,
a prompt will be displayed for entering the passphrase.
$ multipass delete --help
Usage: multipass delete [options] [ ...]
Delete instances, to be purged with the "purge" command,
or recovered with the "recover" command.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
--all Delete all instances
-p, --purge Purge instances immediately
Arguments:
name Names of instances to delete
$ multipass help find
Usage: multipass find [options] [][]
Lists available images matching for creating instances from.
With no search string, lists all aliases for supported Ubuntu releases.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity, repeat up to three times for more
detail
Arguments:
string An optional value to search for in [] format,
where can be either ‘release’ or ‘daily’. If
is omitted, it will search ‘release‘ first, and if no matches
are found, it will then search ‘daily‘. can be a
partial image hash or an Ubuntu release version, codename or
alias.
$ multipass help get
Usage: multipass get [options]
Get the configuration setting corresponding to the given key.
Keys:
client.gui.autostart
client.gui.hotkey
client.primary-name
local.bridged-network
local.driver
local.privileged-mounts
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
--raw Output in raw format. For now, this affects only the
representation of empty values (i.e. "" instead of "").
Arguments:
key Path to the setting whose configured value should be obtained.
multipass get 命令 (preview)
multipass get命令提供了一种获取multipass设置的方法。例如:
$ multipass get local.driver
qemu
参考资料中记录了可用的设置。
当不带参数使用时,它将所有可用设置显示为< key>=对的列表:
$ multipass get
client.gui.autostart=true
client.gui.hotkey=Ctrl+Alt+U
client.primary-name=primary
使用- keys选项,它仅列出设置键:
$ multipass get --keys
client.gui.autostart
client.gui.hotkey
client.primary-name
$ multipass get --raw client.primary-name
$ multipass get client.primary-name
使用multipass道帮助获取快速参考:
$ multipass help get
Usage: multipass get [options] [ ...]
Get the configuration setting(s) corresponding to the given key(s), or all settings if no key is specified.
Some common settings keys are:
- client.gui.autostart
- local.driver
- local.privileged-mounts
Use `multipass get --keys` to obtain the full list of available settings at any given time.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
--raw Output in raw format. For now, this affects only the
representation of empty values (i.e. "" instead of "").
--keys List available settings keys. This outputs the whole list of
currently available settings keys, or a matching subset when
... is(are) provided
Arguments:
arg Setting(s) key(s), i.e. path(s) to the setting(s) whose
configured value(s) should be obtained.
$ multipass help
Usage: multipass [options]
Create, control and connect to Ubuntu instances.
This is a command line utility for multipass, a
service that manages Ubuntu instances.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
Available commands:
alias Create an alias
aliases List available aliases
authenticate Authenticate client
delete Delete instances
exec Run a command on an instance
find Display available images to create instances from
get Get a configuration setting
help Display help about a command
info Display information about instances
launch Create and start an Ubuntu instance
list List all available instances
mount Mount a local directory in the instance
networks List available network interfaces
purge Purge all deleted instances permanently
recover Recover deleted instances
restart Restart instances
set Set a configuration setting
shell Open a shell on a running instance
start Start instances
stop Stop running instances
suspend Suspend running instances
transfer Transfer files between the host and instances
umount Unmount a directory from an instance
unalias Remove an alias
version Show version details
$ multipass info calm-squirrel
Name: calm-squirrel
State: RUNNING
IPv4: 10.218.69.109
Release: Ubuntu 16.04.6 LTS
Image hash: 485bf889ca70 (Ubuntu 16.04 LTS)
Load: 0.00 0.03 0.02
Disk usage: 849.4M out of 4.8G
Memory usage: 41.9M out of 992.0M
完整的多通道帮助信息输出解释了可用的选项:
$ multipass help info
Usage: multipass info [options] [ ...]
Display information about instances
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity, repeat up to three times for
more detail
--all Display info for all instances
--format Output info in the requested format.
Valid formats are: table (default), json, csv and yaml
Arguments:
name Names of instances to display information about
$ multipass help launch
Usage: multipass launch [options] [[] | ]
Create and start a new instance.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific
options.
-v, --verbose Increase logging verbosity. Repeat the
'v' in the short option for more detail.
Maximum verbosity is obtained with 4 (or
more) v's, i.e. -vvvv.
-c, --cpus Number of CPUs to allocate.
Minimum: 1, default: 1.
-d, --disk Disk space to allocate. Positive
integers, in bytes, or with K, M, G
suffix.
Minimum: 512M, default: 5G.
-m, --mem Amount of memory to allocate. Positive
integers, in bytes, or with K, M, G
suffix.
Minimum: 128M, default: 1G.
-n, --name Name for the instance. If it is
'primary' (the configured primary
instance name), the user's home
directory is mounted inside the newly
launched instance, in 'Home'.
--cloud-init | Path or URL to a user-data cloud-init
configuration, or '-' for stdin
--network Add a network interface to the
instance, where is in the
"key=value,key=value" format, with the
following keys available:
name: the network to connect to
(required), use the networks command for
a list of possible values, or use
'bridged' to use the interface
configured via `multipass set
local.bridged-network`.
mode: auto|manual (default: auto)
mac: hardware address (default:
random).
You can also use a shortcut of ""
to mean "name=".
--bridged Adds one `--network bridged` network.
--mount : Mount a local directory inside the
instance. If is omitted,
the mount point will be the same as the
absolute path of
--timeout Maximum time, in seconds, to wait for
the command to complete. Note that some
background operations may continue
beyond that. By default, instance
startup and initialization is limited to
5 minutes each.
Arguments:
image Optional image to launch. If omitted,
then the default Ubuntu LTS will be
used.
can be either ‘release’ or
‘daily‘. If is omitted,
‘release’ will be used.
can be a partial image hash or
an Ubuntu release version, codename or
alias.
is a custom image URL that is in
http://, https://, or file:// format.
$ multipass list
Name State IPv4 Release
primary SUSPENDED -- Ubuntu 18.04 LTS
calm-squirrel RUNNING 10.218.69.109 Ubuntu 16.04 LTS
完整的多遍帮助列表输出解释了可用选项:
$ multipass help list
Usage: multipass list [options]
List all instances which have been created.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity, repeat up to three times for
more detail
--format Output list in the requested format.
Valid formats are: table (default), json, csv and yaml
$ multipass help mount
Usage: multipass mount [options] [ ...]
Mount a local directory inside the instance. If the instance is
not currently running, the directory will be mounted
automatically on next boot.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v'
in the short option for more detail. Maximum
verbosity is obtained with 4 (or more) v's,
i.e. -vvvv.
-g, --gid-map : A mapping of group IDs for use in the mount.
File and folder ownership will be mapped from
to inside the instance. Can
be used multiple times.
-u, --uid-map : A mapping of user IDs for use in the mount.
File and folder ownership will be mapped from
to inside the instance. Can
be used multiple times.
Arguments:
source Path of the local directory to mount
target Target mount points, in [:]
format, where is an instance name, and
optional is the mount point. If
omitted, the mount point will be the same as
the source's absolute path
$ multipass help networks
Usage: multipass networks [options]
List host network devices (physical interfaces, virtual switches, bridges)
available to integrate with using the `--network` switch to the `launch`
command.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short
option for more detail. Maximum verbosity is obtained with
4 (or more) v's, i.e. -vvvv.
--format Output list in the requested format.
Valid formats are: table (default), json, csv and yaml
$ multipass purge --help
Usage: multipass purge [options]
Purge all deleted instances permanently, including all their data.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
$ multipass recover --help
Usage: multipass recover [options] [ ...]
Recover deleted instances so they can be used again.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
--all Recover all deleted instances
Arguments:
name Names of instances to recover
$ multipass help set
Usage: multipass set [options] =
Set, to the given value, the configuration setting corresponding to the given key.
Keys:
client.gui.autostart
client.gui.hotkey
client.primary-name
local.bridged-network
local.driver
local.passphrase
local.privileged-mounts
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
Arguments:
keyval A key-value pair. The key specifies a path to the setting to
configure. The value is its intended value.
$ multipass shell
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-72-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Thu Dec 19 16:11:12 EST 2019
System load: 0.0 Processes: 87
Usage of /: 24.0% of 4.67GB Users logged in: 0
Memory usage: 13% IP address for ens4: 10.3.19.167
Swap usage: 0%
11 packages can be updated.
3 updates are security updates.
Last login: Thu Dec 19 16:03:37 2019 from 10.3.19.1
ubuntu@primary:~$
对于名为bionic的实例:
$ multipass shell bionic
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-72-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Thu Dec 19 16:11:12 EST 2019
System load: 0.0 Processes: 87
Usage of /: 24.0% of 4.67GB Users logged in: 0
Memory usage: 13% IP address for ens4: 10.3.19.167
Swap usage: 0%
11 packages can be updated.
3 updates are security updates.
Last login: Thu Dec 19 16:03:37 2019 from 10.3.19.1
ubuntu@bionic:~$
multipass shell --help输出解释了可用的选项:
$ multipass shell --help
Usage: multipass shell [options] []
Open a shell prompt on the instance.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity, repeat up to three times for more
detail
Arguments:
name Name of the instance to open a shell on. If omitted, 'primary'
(the configured primary instance name) will be assumed. If the
instance is not running, an attempt is made to start it (see
`start` for more info).
$ multipass help start
Usage: multipass start [options] [ ...]
Start the named instances. Exits with return code 0
when the instances start, or with an error code if
any fail to start.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity, repeat up to three times for more
detail
--all Start all instances
Arguments:
name Names of instances to start. If omitted, and without the --all
option, 'primary' (the configured primary instance name) will
be assumed. If 'primary' does not exist but is included in a
successful start command (either implicitly or explicitly), it
is launched automatically (see `launch` for more info).
sage: multipass stop [options] [ ...]
Stop the named instances, if running. Exits with
return code 0 if successful.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short
option for more detail. Maximum verbosity is obtained with
4 (or more) v's, i.e. -vvvv.
--all Stop all instances
-t, --time
multipass suspend 命令
$ multipass help suspend
Usage: multipass suspend [options] [ ...]
Suspend the named instances, if running. Exits with
return code 0 if successful.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
--all Suspend all instances
Arguments:
name Names of instances to suspend. If omitted, and without the
--all option, 'primary' will be assumed.```
$ multipass help transfer
Usage: multipass transfer [options] [ ...]
Copy files between the host and instances.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
Arguments:
source One or more paths to transfer, prefixed with for paths
inside the instance, or '-' for stdin
destination The destination path, prefixed with for a path inside
the instance, or '-' for stdout
multipass umount 命令
$ multipass help umount
Usage: multipass umount [options] [ ...]
Unmount a directory from an instance.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
Arguments:
mount Mount points, in [:] format, where are
instance names, and optional are mount points. If
omitted, all mounts will be removed from the named instances.
multipass help unalias` explains the available options:
```plain
$ multipass help unalias
Usage: multipass unalias [options] [ ...]
Remove aliases
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
--all Remove all aliases
Arguments:
name Names of aliases to remove
multipass version 命令
不带参数的multipass version命令将显示multipass的客户端和守护程序版本。
$ multipass version
multipass 1.0.0
multipassd 1.0.0
如果有可用的Multipass更新,则除了上述输出(示例而非实际输出)之外,还会将其打印出来:
$ multipass version
multipass 1.0.0
multipassd 1.0.0
########################################################################################
Multipass 1.0.1 release
Bugfix release to address a crash
Go here for more information: https://github.com/canonical/multipass/releases/tag/v1.0.1
########################################################################################
使用- help选项打印出version命令的用法信息:
$ multipass version --help
Usage: multipass version [options]
Display version information about the multipass command
and daemon.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity, repeat up to three times for more
detail
Arguments: source One or more paths to transfer, prefixed with name: for paths inside the instance, or ‘-’ for stdin destination The destination path, prefixed with name: for a path inside the instance, or ‘-’ for stdout
# `multipass umount` 命令
```nohighlight
$ multipass help umount
Usage: multipass umount [options] [ ...]
Unmount a directory from an instance.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
Arguments:
mount Mount points, in [:] format, where are
instance names, and optional are mount points. If
omitted, all mounts will be removed from the named instances.
multipass help unalias` explains the available options:
```plain
$ multipass help unalias
Usage: multipass unalias [options] [ ...]
Remove aliases
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific options.
-v, --verbose Increase logging verbosity. Repeat the 'v' in the short option
for more detail. Maximum verbosity is obtained with 4 (or more)
v's, i.e. -vvvv.
--all Remove all aliases
Arguments:
name Names of aliases to remove
multipass version 命令
不带参数的multipass version命令将显示multipass的客户端和守护程序版本。
$ multipass version
multipass 1.0.0
multipassd 1.0.0
如果有可用的Multipass更新,则除了上述输出(示例而非实际输出)之外,还会将其打印出来:
$ multipass version
multipass 1.0.0
multipassd 1.0.0
########################################################################################
Multipass 1.0.1 release
Bugfix release to address a crash
Go here for more information: https://github.com/canonical/multipass/releases/tag/v1.0.1
########################################################################################
使用- help选项打印出version命令的用法信息:
$ multipass version --help
Usage: multipass version [options]
Display version information about the multipass command
and daemon.
Options:
-h, --help Display this help
-v, --verbose Increase logging verbosity, repeat up to three times for more
detail
如果在使用JAXB把xml文件unmarshal成vo(XSD自动生成的vo)时碰到如下错误:
org.xml.sax.saxparseexception : premature end of file
很有可能时你直接读取文件为inputstream,然后将inputstream作为构建unmarshal需要的source参数。InputSource inputSource = new In
servlet 搞java web开发的人一定不会陌生,而且大家还会时常用到它。
下面是java官方网站上对servlet的介绍: java官网对于servlet的解释 写道
Java Servlet Technology Overview Servlets are the Java platform technology of choice for extending and enha
这两天学到事务管理这一块,结合到之前的terasoluna框架,觉得书本上讲的还是简单阿。我就把我从书本上学到的再结合实际的项目以及网上看到的一些内容,对声明式事务管理做个整理吧。我看得Spring in Action第二版中只提到了用TransactionProxyFactoryBean和<tx:advice/>,定义注释驱动这三种,我承认后两种的内容很好,很强大。但是实际的项目当中
1)nosql数据库主要由以下特点:非关系型的、分布式的、开源的、水平可扩展的。
1,处理超大量的数据
2,运行在便宜的PC服务器集群上,
3,击碎了性能瓶颈。
1)对数据高并发读写。
2)对海量数据的高效率存储和访问。
3)对数据的高扩展性和高可用性。
redis支持的类型:
Sring 类型
set name lijie
get name lijie
set na
在多节点的系统中,如何实现分布式锁机制,其中用redis来实现是很好的方法之一,我们先来看一下jedis包中,有个类名BinaryJedis,它有个方法如下:
public Long setnx(final byte[] key, final byte[] value) {
checkIsInMulti();
client.setnx(key, value);
ret