前提:一定关关闭selinux!!!,然后重启服务器

安装

  yum -y install vsftpd
  systemctl enable vsftpd.service
  systemctl start vsftpd.service

添加用户
  adduser ftptest
  passwd ftptest

配置文件

/etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
chown_username=ftpuser
xferlog_file=/var/log/xferlog
xferlog_std_format=YES
chroot_local_user=NO
chroot_list_enable=NO
local_root=/data/ftp
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
userlist_deny=NO
tcp_wrappers=YES
allow_writeable_chroot=YES
use_localtime=YES
pasv_enable=YES
pasv_min_port=30060
pasv_max_port=30090

 

用户

/etc/vsftpd/user_list

黑名单
/etc/vsftpd/ftptest

 

java客户端上传文件

    public static void main(String[] args) {
        FTPClient ftpClient = new FTPClient();

        try (InputStream in = new FileInputStream(new File("d:/a.txt"))) {
            ftpClient.connect("192.168.88.131", 21);
            ftpClient.login("ftptest", "******");
            boolean isChange = ftpClient.changeWorkingDirectory("test");
            if (!isChange) {
                // 创建个人目录
                ftpClient.makeDirectory("test");
                // 切换
                ftpClient.changeWorkingDirectory("test");
            }

            // 文件类型
            ftpClient.setFileType(FTPClient.LOCAL_FILE_TYPE);
            boolean is = ftpClient.storeFile(System.currentTimeMillis() + ".txt", in);
            System.out.println(is);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                ftpClient.disconnect();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

 

posted @ 2023-12-09 15:19 空虚公子 阅读(15) 评论(0) 推荐(0) 编辑
摘要: import com.mongodb.client.MongoCollection;import com.mongodb.client.model.geojson.LineString;import com.mongodb.client.model.geojson.Point;import com. 阅读全文
posted @ 2023-07-18 20:49 空虚公子 阅读(70) 评论(0) 推荐(0) 编辑
摘要: import com.mongodb.MongoClient;import com.mongodb.MongoClientOptions;import com.mongodb.MongoCredential;import com.mongodb.ServerAddress; public class 阅读全文
posted @ 2023-07-09 09:36 空虚公子 阅读(211) 评论(0) 推荐(0) 编辑
摘要: import com.mongodb.BasicDBObject;import com.mongodb.client.MongoCollection;import com.mongodb.client.MongoCursor;import com.mongodb.client.model.Accum 阅读全文
posted @ 2023-07-08 09:14 空虚公子 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 官网地址: https://www.mongodb.com/docs/manual/reference/operator/query-geospatial/ git demo https://github.com/mongodb/docs-java/blob/master/source/includ 阅读全文
posted @ 2023-05-08 17:41 空虚公子 阅读(40) 评论(0) 推荐(0) 编辑
摘要: push 前回滚 git reset --hard f0f47e48a7b3fcac8632d978343f66c0464ea16e push后回滚 git reset --hard f0f47e48a7b3fcac8632d978343f66c0464ea16e git push origin H 阅读全文
posted @ 2023-03-27 15:12 空虚公子 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 假设远程地址为 https://gitee.com/donghuawang0658/git-study.git 分支: test 本地操作 git init git remote add origin https://gitee.com/donghuawang0658/git-study.git g 阅读全文
posted @ 2023-03-27 14:37 空虚公子 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1 使用原则 1)单表数据量达到5000万以上,考虑使用分库分表方案分表 2)读写分离可以考虑使用 2 列设计规范 1)主键使用bigint类型,使用雪花算法生成 2)禁止使用外键 3)禁止使用null字段 4)使用int存储ip地址 5)添加字段要慎重,可以考虑第三方存储,比如mongo,redi 阅读全文
posted @ 2023-03-26 17:26 空虚公子 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 前提: 设置挂在路径:docker 设置 resources -- file sharing d:/docker/file 在D:\docker\file\app\es\cfg建立elasticsearch.yml文件,内容: http: host: 0.0.0.0xpack.security.en 阅读全文
posted @ 2023-03-17 09:52 空虚公子 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 必须设置时区,否则查询出来的时间会有问题:(本人安装了mysql,但是修改mysql的配置没起作用) 进入容器执行: cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo ‘Asia/Shanghai’ >/etc/timezone 阅读全文
posted @ 2023-03-17 08:54 空虚公子 阅读(401) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示